Paste JSON
Upload File

Click to select or drag & drop a .json file

What the generator decided

Paste or upload JSON to see every type decision laid out — which field became which TypeScript type, which key was quoted or renamed because it was not a valid identifier, and which array was inferred as a concrete interface versus any[].

All generation runs in your browser. Your JSON is never uploaded to any server.

JSON to TypeScript Converter

Turn any JSON into TypeScript interfaces directly in your browser — no upload, no API call, no tracking. Paste JSON (or drop a .json file) and get TypeScript interfaces with nested types, arrays, nullable fields, and a full type-decision report that shows exactly how each field was inferred.

What it generates

Why the report matters

Most generators hand you an interface and stay silent about the guesses. This one doesn't. For every field it tells you the inferred type. For every non-identifier key it shows what happened. For every array it tells you whether the element type was pinned to a concrete interface or fell back to any[]. That is the difference between types you can trust and types that quietly lie about your data.

Using the output

Copy the interfaces into a .ts file and import them. With "Keep original keys" (default), a key like "first-name" stays quoted and matches your JSON exactly; with camelCase, it becomes firstName and the report lists the mapping. Combine with a runtime validator of your choice if you need to check incoming payloads.

How inference works (and its limits)

Array element types are inferred from the first element of each array; if the elements have differing shapes, the array falls back to any[] and the report says so. Type choices reflect the sample you provide — feed it a representative payload. A field that is never null in the sample stays non-nullable.

FAQ

Is this JSON to TypeScript converter free?

Yes. It runs entirely in your browser, with no login, no usage limits, and no ads on this tool. Your JSON never leaves your device.

Is my JSON data safe?

Yes. All code generation happens locally in JavaScript. Your JSON is never sent to a server, logged, or stored. You can disconnect from the internet after the page loads and it will still work.

What if my JSON keys have spaces or hyphens?

Keys that are not valid identifiers are handled explicitly. By default they are kept verbatim and quoted ("first-name": string;) so they match your JSON exactly. Switch "Properties" to camelCase to get firstName instead — the report lists every change so nothing is hidden.

How are arrays handled?

An array of objects becomes Element[]. An array of primitives becomes string[], number[], etc. If the array's elements have different shapes, it becomes any[] — the report flags this so you know the type was not pinned down.

Does it produce interface or type?

It produces export interface declarations by default (turn off the "export interface" option to drop the export keyword). Interfaces are the idiomatic choice for object shapes and merge cleanly.

Can I convert TypeScript back to JSON?

This tool goes JSON → TypeScript. For the reverse direction, use the CSV to JSON converter for tabular data, or your editor's JSON support for hand-written types.