Skip to content
§
§ · free tool

JSON to TypeScript. Paste JSON, ship types.

Get clean TypeScript interfaces or type aliases from any JSON, optional-property detection, literal unions, readonly props and full naming control. Runs 100% in your browser; nothing is uploaded.

A free online tool by Digital Heroes
Emit as

Your JSON never leaves your browser, nothing is uploaded.

TypeScript Waiting for input…

            

Codegen without the round-trip

Paste an API response, a config file or any JSON object and the converter infers a full type model on your device: nested objects become their own named interfaces, arrays of objects are merged so a key missing from some items comes out as an optional ? property, and small repeated string sets become literal unions like 'shipped' | 'pending'. Choose interfaces or type aliases, T[] or Array<T>, how nulls are treated, quotes, semicolons and indentation, then copy the result or download a ready-to-import .ts file. No account, nothing uploaded, free forever.

§ 02 · what you can do

Everything a converter should do.

  • Convert JSON to TypeScript interfaces or type aliases the moment you paste, no button to press.
  • Auto-detect optional properties by merging shapes across array items, so ragged API data types honestly.
  • Generate literal union types for small string sets (up to 4 unique values) like status or role fields.
  • Control the output style: export keyword, readonly props, semicolons, quotes, T[] vs Array<T>, null and unknown handling, nested-name prefixes and indent size.
  • Copy or download a ready-to-use .ts file named after your root type.
  • Load any .json file by dropping it onto the page, read locally, never uploaded.
§ 03 · how to use it

Four steps, no manual.

  1. Paste your JSON into the left panel, or drop a .json file onto the load zone (up to 15 MB, read locally).
  2. Name the root type and pick interface or type alias, the TypeScript regenerates live.
  3. Tune the options: array syntax, quotes, null handling, optional detection, readonly, literal unions, indentation.
  4. Copy TypeScript to your clipboard or Download .ts, your data stays on your device throughout.
§ 04 · faq

Frequently asked questions.

Is JSON to TypeScript free?
Yes, completely free for everyone. No sign-up, no account and no usage limits.
Is it private? Is my JSON uploaded anywhere?
No upload, ever. Parsing and type generation run entirely in your browser on your own device, your JSON never leaves your computer, whether you paste it or load a file.
Does it work offline?
Yes, once the page has loaded, conversion keeps working without a connection, because all the logic runs locally in your browser. Nothing is installed and no server is involved.
How does optional-property detection work?
The converter merges the shape of every object in an array. If a key appears in some items but not all, like a note field on only one order, it's emitted as an optional property with a ?. You can also make null-valued fields optional via the "Null values" option.
When are literal union types generated?
When a string field is seen at least twice and has 4 or fewer unique values, a typical status or role field, it becomes a literal union like 'shipped' | 'pending' instead of plain string. Untick "Small string sets as literal unions" to always emit string.
Can I load a .json file instead of pasting?
Yes, drop a file onto the "Load .json" zone or click it to browse, up to 15 MB. The file is read with your browser's FileReader API on your device; it is never transmitted anywhere.

Published · Last updated .

Online now

Hi there. How can we help you today?

Reply