How it works
How to use the JSON ↔ TypeScript
Paste a JSON response
For example, from an API you are integrating with.
Name the root type
Nested objects get their own named interfaces, derived from their keys (items → Item).
Copy into your project
Or switch to TypeScript → JSON to create mock data from existing types.
Smart type inference
Array elements are merged so fields that appear only sometimes become optional (gift?: boolean), mixed values become unions (string | number), and identical nested shapes share a single interface. Keys that are not valid identifiers are quoted automatically.
The reverse direction understands interfaces, type aliases, enums, unions, arrays, Record<K, V>, extends and utility types like Partial<T>, and fills in realistic sample values based on field names.
Built for developers
Why developers use it
Private by design
Runs 100% in your browser. Nothing you paste is uploaded, logged or stored on a server.
Instant results
Output updates as you type, with precise error locations when something is wrong.
Works offline
Once loaded, the tool keeps working without a connection. Install it as an app if you like.
Free, no sign-up
No accounts, no limits, no watermarks.
FAQ
Frequently asked questions
Interface or type alias?
Both describe object shapes equally well. Interfaces can be extended and merged; type aliases can express unions. Pick whichever your codebase uses.
How are null values typed?
As a union with null (field: string | null). Enable "null → optional" to write field?: string instead.
Is my data uploaded anywhere?
No. This tool runs entirely in your browser. Your input never leaves your device, is not logged, and works offline once the page has loaded.
Keep going
Related tools
- JSON Schema GeneratorInfer a JSON Schema from sample JSON
- JSON to PythonGenerate Python classes from JSON
- JSON to GoGenerate Go classes from JSON
- JSON ↔ JavaGenerate Java POJOs, Lombok classes or records from JSON
- JSON ↔ C#Generate C# classes or records from JSON (and back)
- JSON to RustGenerate Rust classes from JSON
- JSON FormatterFormat, validate and explore JSON
- JSON ValidatorFind and fix JSON syntax errors