Skip to main content
Uddatak

JSON to Type Definitions Converter

Paste JSON data — like an API response — and this tool infers its structure to generate an equivalent, ready-to-paste type definition: a TypeScript interface, a Python dataclass, or a Go struct, with optional fields detected when they're missing from some array elements, and integers distinguished from floating-point numbers. Because the inference is based only on your sample data, always double-check the result. Runs entirely in your browser — the JSON you paste is never sent to a server.

Developer Tools Runs entirely in your browser

Everything happens in your browser — the JSON you paste is never sent anywhere.

Types are inferred from your actual sample data, so always sanity-check the result — a field missing from the sample won't appear in the output, and a numeric field that's always a whole number in the sample is treated as an integer, not a float.

Paste JSON above to generate an equivalent type definition.

What this tool does

Infers a data shape from a sample JSON value and generates type definitions you can paste into your code.

When to use it

  • Integrating with an API that has no type documentation but whose real response you have.
  • Wanting types for a data structure without writing them field by field.
  • Moving untyped data into type-checked code.

How to use it

  1. Paste a sample JSON into the input field.
  2. Read the generated type definitions.
  3. Copy them into your project.

A practical example

Input

A response containing a user object and an orders array.

Output

Type definitions for the root object, for user, and for an orders element, with each field's type inferred from its value.

Limitations

  • Inference comes from one sample: a field that is null in the example has no knowable real type, and an absent optional field will not appear at all.
  • Array element type names come from a simple rule that strips a trailing "s", which is enough for names like items and users but is not a real linguistic singulariser — check the generated names.
  • Review the output before relying on it; it is a good starting point, not a documented contract.

Privacy and processing

Everything happens in your browser — the JSON you paste is never sent anywhere.

Technical notes

  • Inference walks the data structure only and executes nothing inside it.
  • The inferred shape is kept separate from code generation, so adding a language does not touch the inference logic.

Frequently Asked Questions

The definition is inferred only from the sample data you paste. A field missing from the sample won't appear in the result, and a numeric field that's always a whole number in the sample is treated as an integer, not a float — so always review the result.

Explore our other tools

Dozens of everyday tasks made easier with Uddatak.

Browse all tools