All tools

JSON to TypeScript

Make TypeScript types or a JSON Schema from a sample of JSON. Free, with no account or uploads.

Paste JSON to make TypeScript types

Types are worked out from the sample you give, so check optional keys against your real data.

Paste below or drop a text file here · up to 10 MB

CSV/table view need an array of objects. CSV imports keep cells as strings. YAML aliases, merge keys, custom tags and non-string keys must be expanded or converted first. Types/schemas describe one sample and need review.

Results appear here; your source stays intact.
Start with a document or try the example.Ctrl/Cmd + F to find · Ctrl/Cmd + Z to undo · Escape, then Tab to leave the editor

Source, comparison and schema text stay in this tab and clear on refresh. Files are not uploaded. The editor never runs pasted JavaScript. Cancel stops the worker without changing your source.

How it works and help
One workspace. All on your device.
5 million characters · 100 levels · 100,000 values

A little help along the way

Say what you want to do: make it readable (Edit, to format or repair), look through it (Explore), turn it into CSV or YAML (Convert) or compare two (Compare). The page says at once whether your JSON is valid. Under More options every workflow has its tab, with Query to select data and Schema to check a contract. Results stay separate until you choose Use result as source.

Questions people ask

Are optional keys marked with a question mark?
No. The types describe the one sample you paste, so every key in it is required. Add ? to the keys you know can be missing, or paste a sample that shows the differences.
What does an array of different things become?
A union of what it holds, such as Array<string | number>. Objects of different shapes in one array become a union of each shape rather than one merged type.
Can it make a JSON Schema instead?
Yes. Choose JSON → JSON Schema under Conversion for a 2020-12 schema of the same sample, with every key it saw required.

This page is the JSON formatter, opened for this one job; every other tool it has is one press away. Each of its settings is explained on the JSON formatter's own page.