$ json2ts
JSON to TypeScript
Paste a JSON sample and get TypeScript interfaces or types generated from it, with nested objects and arrays handled.
Ad slot
How types are inferred
Each object becomes a named interface, using the key name in PascalCase. Arrays take the union of their element types, so [1, "a"] becomes (number | string)[]. Objects inside arrays are merged: a key missing from some elements is marked optional. null values become null; combine with a real sample to get string | null.