Ulvixor

Search tools

Search all of Ulvixor's tools by name or keyword.

JSON to TypeScript Interface Generator

Paste a sample JSON and instantly get the matching TypeScript interfaces. Nested objects become separate interfaces, and if you paste an array of objects, fields that aren't present in every element are automatically marked as optional.

How it works

  1. Paste your JSON into the input panel (or use the built-in example).
  2. The tool parses the structure and generates one interface per nested object, named after the key where it appears.
  3. If the root JSON (or an array inside it) contains several objects, their keys are merged: a field missing from at least one element is marked with '?' as optional.
  4. Arrays are represented as `Type[]`, and mixed values as a union of types.
  5. Copy the result with one click.

Use cases

  • Quickly generate TypeScript types for an API response from a real sample.
  • Create the interface for a configuration object without typing it field by field by hand.
  • Detect which fields are optional in a data collection (for example, API results) by comparing several elements at once.
  • Quickly learn what a complex JSON structure would look like in TypeScript.

Common mistakes

  • Pasting a single sample object and expecting the tool to guess which fields are optional in the rest of your data.
    The tool can only infer optional fields by comparing several elements of an array. If you paste a single object, every field is marked required; paste an array with several representative samples if you need optionality detected.
  • Expecting the tool to validate business rules or generate validation types (like Zod), not just the data's shape.
    This tool only describes the structural shape of the JSON sample you gave it (which fields exist and their type), not additional validation rules. For that, tools like Zod or io-ts require defining the schemas by hand.
  • Pasting JSON with 'null' values and expecting a more specific type to be inferred automatically.
    A 'null' value in the sample is typed literally as `null`. If that field can hold other types in other cases, edit the generated interface by hand to reflect the full union (for example, `string | null`).

Frequently asked questions

No. Interface generation happens entirely in your browser using JavaScript. Your JSON never leaves your device.

This only applies when you paste an array of objects: the tool merges the keys of every element and marks as optional (with '?') any key that isn't present in absolutely all of them.

An error message is shown indicating the JSON is invalid, along with the parser's detail, instead of generating an incorrect interface.

Each nested interface takes the name of the key where it appears, converted to PascalCase (for example, the key 'address' generates an 'Address' interface). If the name is already in use, a number is appended.

Alternatives

VS Code extensions like 'Paste JSON as Code' do something similar right in the editor, and more complete tools like quicktype generate types for several languages at once. This tool is handy for a quick conversion with no extension to install, straight from the browser.