What this converter accepts
The input must be valid JSON: an object, an array, or a primitive. Nested objects become named types. Arrays of objects are merged so fields that appear in only some items are marked optional. Empty objects emit an empty type, and empty arrays emit unknown[].
The sample JSON on the left is a real payload the tool converts immediately. Change the root name, switch between interfaces and type aliases, pick 2- or 4-space indent, then copy or download a .ts file.
Nested objects, arrays, null, and optional properties
A nested object such as profile is extracted into its own interface or type alias and referenced from the parent. Arrays of objects share one item type. When two records disagree on a key, that key is optional.
A field that is null in the sample is typed as null. If you prefer optional properties instead, use Null fields → Mark optional. Mixed arrays such as [1, "two", true] become a union.
Limits of sample-based inference
This tool infers types from one JSON value. It cannot see JSON Schema, OpenAPI, or runtime types your API might return later. A field that is always a string in production but happens to be missing in this sample will not appear. Enums are suggested only when a small set of short string tokens repeats.
Conversion runs in the page's JavaScript. The JSON you paste is not posted to a conversion API. Loading the website still uses HTTPS to the host, which may record ordinary request logs. See the Privacy Policy for details.