json→ts

JSON to TypeScript

Paste a JSON sample and get TypeScript interfaces back.

Using toolbook means you agree to our Terms and Privacy Policy.

Declare as
Arrays

Explain this shape in English

Optional. Uses an AI model built into your browser, on your device. The interfaces above work without it.

Checking what your browser can do…

Data sent from your device
0 bytes sent

Your files stay on your device

How to use it

Paste a JSON sample and get TypeScript interfaces as you type, with optional fields and mixed types worked out from your data. Your JSON stays on your device.

Paste a sample of your JSON — like an API response — and the TypeScript interfaces appear as you type, ready to copy into your code.

Tip: paste a list of several records, not just one. Fields that appear in some records but not others are marked optional, and that only works if there’s more than one record to compare.

Nested objects get their own named interfaces, and identical shapes share one, so the result stays tidy.

Your data never leaves your device, which matters when your sample is a real API response with real customer data in it.

FAQ

Why are some fields optional?

They appear in some records of your sample but not others. Paste more records for a more accurate result.

Why is a field typed string | number?

Your sample had both types in that spot, so the type says exactly that.

Why are dates typed as string?

JSON has no date type — dates arrive as text, so string is the accurate type.

Can anyone else see my JSON?

No. Everything runs on your device and nothing is sent anywhere.

How it worksFor the curious

The sample is parsed and walked; each value becomes the TypeScript type it already is. Nested objects are extracted into named interfaces, and structurally identical objects share one interface.

Three things are inferred. A key missing from some records becomes optional. A field holding different types across records becomes a union such as string | number rather than any. An empty array carries no information, so it is typed unknown[] and reported.

Some guesses are deliberately not made. A date-like string stays string, because that is what it is after JSON.parse; emitting Date would not type-check against the data. Integers and floats are both number.

The optional “explain in English” panel uses a language model built into your browser, on your device, where one exists. The interfaces themselves come from a plain algorithm.

Related tools