Package Exports
- @typeweaver/json2ts
- @typeweaver/json2ts/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@typeweaver/json2ts) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
JSON-to-TypeScript Converter | @typeweaver/json2ts
Convert JSON to TypeScript interfaces effortlessly.
An open-source tool for developers to generate TypeScript types from JSON objects quickly and securely.
π Features
- 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.
π¦ Installation
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
π οΈ Usage
Programmatic API
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;
// }
β¨ Example
Input JSON:
{
"name": "John",
"age": 30,
"address": {
"city": "New York",
"zip": "10001"
}
}
Generated TypeScript Interface:
interface Root {
name: string;
age: number;
address: {
city: string;
zip: string;
};
}
π Documentation
For more details, advanced examples, and troubleshooting, check the project wiki.
π€ Contributing
We welcome contributions!
If you want to enhance this project, please refer to the CONTRIBUTING.md file for guidelines.
License
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.
MIT License
@typewraper/json2ts is MIT licensed.
π Acknowledgments
- Developed by [Glincker](https ://github.com/glincker).
- Part of the GLINR ecosystem.
π¬ Feedback
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.