How to use the JSON to TypeScript
- Paste a JSON sample on the left. Several examples in an array give better types.
- Name the top-level type.
- Copy the TypeScript code.
Questions
Is my data uploaded anywhere?
No. The tool runs entirely in your browser. Nothing you paste or drop is sent to a server, logged or stored, so it's safe for API responses, config files and other private data.
How are optional fields detected?
If you paste an array of objects and a field is missing from some of them, it's marked optional. More sample data gives more accurate types.
Can I do this in VS Code?
Yes. Nifty Paste JSON as Code pastes JSON straight into a TypeScript file as interfaces.