JSON Formatter
Pretty-print, validate and minify JSON with friendly error messages.
Convert JSON to TypeScript interfaces and types.
Your result is ready — download it below:
Re-encoded without size gain Download links expire within 30 minutes.
No result to display for the current input.
Convert JSON to TypeScript interfaces and types.
Paste a sample API response and get TypeScript interfaces that describe it. Instead of hand-writing types from a large JSON blob, let the generator infer the shape, including nested objects and arrays, then paste the result into your project.
The sample is parsed, and each value is mapped to a TypeScript type: strings become string, numbers become number, booleans become boolean, and objects become named interfaces. Arrays are typed from their elements, and the whole result is printed as ready-to-use code.
Nested objects are emitted as their own interfaces named after their key, so a deeply nested response stays readable rather than turning into an unreadable inline type. Arrays of objects produce an interface plus an array type. Duplicate shapes are reused where possible.
A JSON sample is only one example of the data. A field that is null here may be a string in the next response, so check the generated types against the API documentation. Arrays that mix types are widened, and fields missing from an object are not automatically made optional.
The root name becomes the main interface name. Use the domain concept rather than a generic name such as Data, so the code reads well at the call site. Nested interface names follow their keys, which is why consistent naming in the API response matters.
The JSON is processed only to generate the types and is not stored. The result is a starting point, not a replacement for a schema: the generator cannot know which fields are optional or which unions the API allows beyond the sample you provide.
Paste a JSON sample, set the root name and generate. The output is TypeScript interface code you can copy into your project.
Yes. Nested objects become separate interfaces named after their keys, rather than being flattened.
Arrays are typed from their elements. An array of objects produces an element interface and an array type that uses it.
A null in the sample becomes a nullable type. Check the real API for fields that are sometimes null but not always, and adjust the generated types accordingly.
No. The sample is processed to generate the output and is not saved.
Usually yes for a first pass. Review optional fields, unions and date formats, which cannot be inferred reliably from a single sample.
Convert JSON to TypeScript interfaces and types online. Paste a sample response and get typed definitions you can drop into your project.
How to use: paste a JSON sample, choose a root name, and generate the TypeScript interfaces.
Pretty-print, validate and minify JSON with friendly error messages.
Turn any JSON into ready-to-compile Rust struct definitions with serde derives.
Turn any JSON into a TypeScript Zod schema with nullable and optional handling.
Convert any JSON into Go struct definitions with json tags and pointers for optionals.