JSON to TypeScript
Generate TypeScript interfaces from JSON.
Paste JSON and generate TypeScript interfaces that match nested objects, arrays and mixed types.
Loading the interactive tool… This page needs JavaScript to run the JSON to TypeScript.
How to use JSON to TypeScript
- Paste the data, code, token, or value you need to inspect.
- Set any format, encoding, or validation options.
- Run the tool and inspect the result or diagnostic output.
- Copy the output into your terminal, editor, API client, or project.
How JSON to TypeScript works
Paste a sample JSON document and name the root type. The tool infers a TypeScript interface from the sample: strings, numbers and booleans become primitives, arrays become typed arrays, and nested objects become their own named interfaces. A key missing from some array items is marked optional with a question mark. Types come from one sample only, so null values become type null and unions beyond that are not guessed.
Worked example
Input: JSON with id 1, name ToolsKit, tags of two strings and an owner object with login rumitech and site null → Output: interface Root with id number, name string, tags string[], owner Owner, then interface Owner with login string and site null.
Common uses
- Create types quickly for an API response you are about to consume.
- Start a data model for a mock server from a real sample.
- Document the shape of a JSON config file in TypeScript.
Best for
- typing API responses
- prototyping models
- migrating JavaScript projects
Tips for better results
- Review generated types for fields that may be null.
- Validate the output before using it in production code.
- Treat tokens, credentials, and secrets as sensitive even when processing happens locally.
- For large payloads, keep an original copy so you can compare changes.
Frequently asked questions
Does it detect optional fields?
Where array items differ, missing keys are marked optional.
Is the JSON sent anywhere?
No. The conversion runs in your browser.
Is my data sent to a server?
No. This tool runs in your browser, so what you enter stays on your device.
Related tools
- CSV to JSON — Convert CSV data with headers into JSON array.
- JSON to CSV — Convert a JSON array of objects into CSV data.
- JSON to YAML — Convert JSON data into readable YAML.
- JSON Diff — Compare two JSON documents and list every difference.
- JSON Formatter — Beautify and validate JSON with indentation.
- JSON Minifier — Remove JSON whitespace for compact payloads.