Convert JSON to TypeScript interfaces effortlessly.
An open-source tool for developers to generate TypeScript types from JSON objects quickly and securely.
- Fast Conversion: Generate TypeScript interfaces from JSON in seconds.
- Nested Objects Support: Handles deeply nested structures with ease.
- Array Depth Detection: Automatically detects array depth and types.
- ISO Date Recognition: Converts valid ISO date strings to
Date
type. - Secure Offline Use: No need to paste your data online—works locally.
- Customizable Future Enhancements: Support for advanced type handling and customizable options in future updates.
You can install the package globally using any of these package managers:
Using NPM:
npm install -g @typeweaver/json2ts
Using Yarn:
yarn global add @typeweaver/json2ts
Using PNPM:
pnpm add -g @typeweaver/json2ts
Import and use the package in your Node.js or TypeScript project:
import { convertJsonToTs } from '@typeweaver/json2ts';
const json = { name: "John", age: 30 };
const tsInterface = convertJsonToTs(json);
console.log(tsInterface);
// Output:
// interface Root {
// name: string;
// age: number;
// }
{
"name": "John",
"age": 30,
"address": {
"city": "New York",
"zip": "10001"
}
}
interface Root {
name: string;
age: number;
address: {
city: string;
zip: string;
};
}
For more details, advanced examples, and troubleshooting, check the project wiki.
We welcome contributions!
If you want to enhance this project, please refer to the CONTRIBUTING.md file for guidelines.
This software is also available under the GLINR | GLINCKER LLC proprietary license. The proprietary license allows for use, modification, and distribution of the software with certain restrictions and conditions as set forth by GLINCKER LLC.
You are free to use this software for reference and educational purposes. However, any commercial use, distribution, or modification outside the terms of the MIT License requires explicit permission from GLINCKER LLC.
By using the software in any form, you agree to adhere to the terms of both the MIT License and the GLINCKER LLC proprietary license, where applicable. If there is any conflict between the terms of the MIT License and the GLINCKER LLC proprietary license, the terms of the GLINCKER LLC proprietary license shall prevail.
@typewraper/json2ts is MIT licensed.
- Developed by Glincker.
- Part of the GLINR ecosystem.
- Managed by TypeWeaver
We’d love to hear from you!
Submit your ideas or suggestions via issues in the repository or join the discussion on the GLINR Community.