Docelora
ToolsAboutContact
Developer tools

JSON to TypeScript

Paste a JSON response and get TypeScript types for it. Nested objects become their own interfaces, arrays of objects are merged, and fields missing from some items are marked optional.

Quick answer: paste JSON (for example an API response), set the root type name and choose interfaces or type aliases. Review the result – types are inferred from the sample, so a field that is sometimes null only shows null if your sample includes it.

JSON to TypeScript

Interfaces or types · optional fields · live

Runs on your device: everything you type or open is processed in this browser tab. Nothing is uploaded to Docelora or anyone else.

How types are inferred

JSONTypeScript
"text"string
42, 4.2number
trueboolean
nullnull
{…}a named interface
[1, 2]number[]
[{…}, {…}]one merged interface; keys missing in some items become optional
[1, "a"](number | string)[]
1. Paste JSONA representative sample.
2. Name the rootFor example User.
3. Copy the typesRefine names and unions as needed.

Related tools

Frequently asked questions

How accurate are the types?

They describe your sample exactly; real data may have more variations.

What are optional fields?

Keys that appear in some array items but not others are marked with ?.

Interface or type?

Both work for objects; choose your team’s convention.

How are nested objects named?

From their key, e.g. address becomes Address.

What about empty arrays?

They become unknown[] because the item type cannot be inferred.

Are dates detected?

No – dates in JSON are strings.

Can I generate Zod schemas?

Not yet.

Does it handle large JSON?

Yes, though very large samples produce many types.

What if two nested objects share a name?

A number is added, e.g. Item2.

Is my JSON uploaded?

No.

Are keys with spaces supported?

Yes – they are quoted.

Does it export the types?

Yes – every type is exported.

What if the root is an array?

An item interface plus a root type alias is created.

Can I use the output in JavaScript with JSDoc?

Not directly – it is TypeScript syntax.

Is my code uploaded?

No – it is processed in your browser and never leaves your device.

Is it free?

Yes, with no sign-up or limits.

Can I open a file?

Yes – use “Open file”, or paste the code.

Does it work offline?

Once the page and its library have loaded, yes.

Can I copy or download the result?

Copy it with one click, or download where offered.

Does it work on a phone?

Yes, though large files are easier on a computer.

Last reviewed: 8 November 2026.