Runs in your browser. Your input is not uploaded.

JSON to TypeScript types

Infer TypeScript interfaces or types from a JSON sample.

Loading the tool…

What it does, how to use it, and questions

What it does

Inferring TypeScript types from a JSON sample turns nested objects into interfaces or type aliases and arrays into typed arrays.

Optional vs required is a guess from a single sample: keys present are required in the output unless marked otherwise.

How to use it

  1. Paste JSON.
  2. Choose interface or type alias output.
  3. Copy the TypeScript.

Things to watch for

  • A single sample cannot prove a field is optional. Add ? yourself when the API omits keys.
  • Numbers stay number; big integers that lost precision in JSON.parse are already wrong before codegen.

Questions

Does it use the JSON Schema tool?
No. It infers from a sample. Use Schema codegen when you already have a schema.
Are nested objects named?
Nested object types are inlined or given generated names depending on depth.
null handling?
null becomes null in unions when mixed with other types in an array sample.
Is the JSON uploaded?
No.