CoreJSON

JSON to TypeScript

The JSON to TypeScript generator turns a sample JSON payload into TypeScript interface or type definitions. Paste a response body and get typed models you can drop into your project — no sign-up, and nothing is uploaded. It is the quickest way to type an API response without writing the interfaces by hand.

Open in the workbench Runs locally · nothing is uploaded

How to use it

  1. 1

    Paste sample JSON

    Drop in a representative payload. One sample per shape is enough to infer the structure.

  2. 2

    Generate types

    The generator infers property types, nesting and optionality and produces TypeScript declarations.

  3. 3

    Choose interface or type

    Pick the style your codebase prefers and rename the root type if you like.

  4. 4

    Copy into your project

    Copy the declarations straight into your TypeScript files.

Key features

Instant typed models

Get interfaces or type aliases from a payload in one step.

Nested structures

Nested objects and arrays are inferred into named or inline types as appropriate.

Style options

Choose between interface and type declarations to match your conventions.

Local and private

Generation runs in your browser; API responses are never uploaded.

Handles real payloads

Large JSON is processed with worker-based parsing so the UI stays responsive.

Good for API clients

Ideal for typing REST and GraphQL response bodies.

Common errors & troubleshooting

  • ! A more representative sample produces more accurate types — include every field you expect to see.
  • ! Optional fields (present in some samples, missing in others) are inferred as optional; use representative samples to get this right.
  • ! Numbers are typed as number, but note that very large integers can lose precision in JavaScript.
  • ! Arrays are inferred from their first element; include a representative element to avoid widening to any.

Frequently asked questions

Is the JSON uploaded when generating TypeScript?

No. The generator runs locally in your browser; your payload never leaves your device.

Does it produce interfaces or type aliases?

Both are supported — choose the style that fits your codebase.

How are nested objects handled?

Nested objects become their own interface or type and are referenced from the parent, so the output stays readable.

Can it generate other languages too?

Yes. The same engine generates Java, C#, Go, Python, Kotlin, Rust, Swift and Dart models — this page is the TypeScript entry point.

Related tools