Skip to content
JSON → TypeScriptDeveloper tools

JSON to TypeScript Converter

Paste JSON and get TypeScript interfaces or types: nested interfaces, optional keys, unions and quoted keys. Updates as you type.

Did this tool work for you?

Used JSON to TypeScript Converter? Share how it went to help others.

About this tool

About JSON to TypeScript Converter

JSON to TypeScript Converter writes TypeScript types from a sample of JSON, such as the response of an API. Paste the JSON and the declarations appear at once and change as you edit. Every nested object becomes an interface of its own, named after its key, so a key called profile gives an interface called Profile. Arrays of objects are named in the singular, so users gives User. When the items of an array differ, they are merged into one interface, and a key that is missing from some of them becomes optional with a question mark. This is the case that hand-written types most often get wrong. A key that holds different kinds of values becomes a union, for example number or string. An empty array becomes unknown, because there is nothing to learn from it. A key that is null becomes null in a union with the other types seen for it, and with one option every null key becomes optional instead. Keys that are not valid names in TypeScript, such as first-name or keys that start with a digit, are written in quotes. Two objects with the same shape share one interface, and different shapes that would get the same name are numbered, such as Item and Item2. You can name the root type, choose interface or type, and add export to every declaration. A JSON array at the top level gives a type for its items and an array type for the whole. Errors in the JSON are shown with the line and column, so a missing comma is quickly found. Copy the result or download it as a .ts file. Everything runs in your browser, so API responses with private data are not sent anywhere. Remember that types are only as good as the sample. Include every field and a few array items, and check the result against the documentation of the API.

JSON to TypeScript Converter tool

When to generate TypeScript types

Less typing, fewer mistakes

API responses

Types for a fetch call.

ExamplePaste a real response.

Front-end projects

Props from sample data.

ExampleChoose type and export.

Config files

Type a settings.json.

ExampleRoot name Config.

Webhooks

Payloads from other services.

ExampleInclude a few events.

Migrating to TypeScript

Types for old JavaScript data.

ExampleStart with the largest object.

Learning TypeScript

See how JSON maps to types.

ExampleCompare both panes.

JSON to TypeScript tips

Better types from better samples

Several array items

Optional keys are only found when some items lack them.

Check nulls

A key that is null in the sample may hold a string elsewhere. Adjust it by hand.

Dates are strings

JSON has no date type, so dates come out as string.

JSON not valid?

Find and fix the error first.

Open JSON Formatter

Need a schema?

Make a JSON Schema from the same data.

Open JSON Schema Generator

Compare two responses

See what changed between them.

Open JSON Diff
Built & tested by

HemantInsights

Senior Software Engineer · Developer of Toolyconvert

Hemant developed JSON to TypeScript Converter and tests it on desktop and mobile with real files. He is a senior software engineer from Dehradun, India, building websites since 2014, and designed and developed Toolyconvert end to end.

Last updated 26 November 2026

Answers and guidanceFrequently Asked Questions
How do I convert JSON to TypeScript?
Paste the JSON. The interfaces appear at once; copy them or download a .ts file.
Interface or type?
Both work for objects. Choose the one your project uses.
How are optional fields found?
When items of an array differ, keys that some items lack become optional.
What happens to null?
It becomes null in a union, or the key becomes optional when you choose that.
Can it handle an array at the top?
Yes. You get a type for the items and an array type for the whole.
Why is a key in quotes?
Its name is not a valid TypeScript name, for example first-name.
Is my JSON uploaded?
No. It is converted in your browser.
More tools for your workflowRelated Tools

Featured on

Toolyconvert is listed on these product directories and launch platforms.