Skip to the tool
GigaJSON

JSON to TypeScript

All tools
Format and check
View and query
Convert
JSON to code
Encode and decode
Sample files
Guides Open GigaJSON
Input JSON
Output TypeScript

The TypeScript output appears here as you type.

Ready Runs in your browser

Paste an example, like an API response or a config file, and get TypeScript interfaces for it. Nested objects get their own interfaces. A field missing from some items becomes optional, and a field with mixed values becomes a union. For a JSON Schema instead, use the JSON Schema Generator. For runtime checks, use JSON to Zod; for other languages, Go, Python, Java and more.

How to use it

  1. Paste JSON or open a file.
  2. The interfaces appear as you type.
  3. Copy them into your code or download a .ts file.

Read more: How to create a JSON Schema from JSON

Private, and made for big files

This tool runs in your browser, in a background worker: nothing you paste or open is uploaded, and nothing is kept after you leave. Input can be up to 1 GB, but this operation needs its output to fit in the browser’s text limit. A smaller input may be required. Already loaded features keep working if your connection drops. Loading another tool or jq for the first time needs a connection. When one tool isn't enough, GigaJSON opens your data with a tree, a table, JSONPath/JMESPath/jq queries, transforms, diff and history.

Missing fields and inferred types

Compare two records, one with a note and one without:

[{"id":"001","total":149,"note":"gift"},{"id":"002","total":89}]

The records have string IDs and numeric totals. Because one record lacks note, the generated object type marks that field optional. Keep IDs quoted if leading zeros matter.

Inference only sees the examples you provide. An API may permit values absent from this sample. Review unions, optional fields and nulls against its contract. TypeScript types do not validate a network response at runtime; the JSON Schema generator is a separate starting point for a validation schema.

Large inputs and inferred output need browser memory. This converter is not a promise that a 1 GB document will produce a practical type definition.

GigaJSON generating TypeScript types from two records with a missing note fieldGigaJSON generating TypeScript types from two records with a missing note field (dark theme)
The examples describe a possible shape; generated types still need review against the real API contract. Screenshots follow the page theme. Click to view full size.

Questions

How are optional fields detected?

If a key is missing from some objects in a list, it's marked optional (key?:).

Is my data uploaded?

No. The tool runs in your browser, in a background worker. Nothing you paste or open goes to a server, and nothing is kept after you leave the page.

All tools