JSON to TypeScript

Convert JSON objects and arrays to TypeScript interfaces online. Nested named types, optional and nullable fields, instant output.

Generated code will appear here...

Everything runs locally in your browser. Your JSON is never uploaded or stored.

What is a JSON to TypeScript converter?

A JSON to TypeScript converter turns a raw JSON sample into ready-to-use TypeScript interfaces. Paste a realistic API payload and get typed models instantly — handy for API clients, mocks, and config files. Everything runs in your browser.

How to generate TypeScript from JSON

Paste your JSON, optionally set the root interface name, and the code appears live on the right. Press Copy and drop the interfaces into your project.

How types are inferred

Strings map to string, numbers to number, booleans to boolean. Nested objects become named interfaces, arrays of objects are merged into one element interface, and arrays mixing primitive types become unions such as string | number.

Optional, nullable, and naming

Properties missing from some array elements are emitted as optional (prop?), explicit nulls add | null, and the root name you type is reused for every nested name, e.g. ApiResponseItem.

Frequently Asked Questions

How do I convert JSON to TypeScript interfaces?+
Paste a JSON object or array into the input box. Interfaces are generated instantly: nested objects become named interfaces, arrays are merged into a single element type, and you can copy everything with one click.
How are nested objects and arrays handled?+
Every nested object becomes its own exported interface named after its key, e.g. items inside Root becomes RootItem. Arrays of objects are merged so shared properties are kept, and properties missing in some elements are marked optional.
What happens to missing or null values?+
A property that is absent in some array elements gets the optional modifier (?), and explicit nulls add | null to the type, so the generated interfaces match what the API can really return.
Is my JSON uploaded to a server?+
No. All conversion runs locally in your browser — nothing is sent, stored, or logged.

Related Tools

JSON to TypeScript — free online json to typescript, json to ts, json to interface, typescript interface generator, json to typescript converter, generate typescript from json, typescript types from json, json to ts interfaces, convert json to typescript free, json to interface online. No signup required. Works in your browser.