# JSON to TypeScript

Canonical: https://dev.eneawork.it/json-to-typescript
Language: en
Updated: 2026-11-02
Author: Enea Zani (https://eneawork.it)

Turn any JSON sample into clean TypeScript interfaces.

## What it does

Typing API responses by hand is slow and easy to get wrong. Paste a representative JSON sample and this converter infers nested interfaces, merges array item shapes and marks fields missing from some items as optional. Review the result: one sample cannot reveal every possible response shape.

## How to use

1. Paste a representative JSON sample.
2. Set the root interface name and options.
3. Copy the generated TypeScript.

## FAQ

### Does it call my API?

No. You paste a JSON sample; no request is made and no URL is needed.

### How are arrays handled?

Object items are merged into a single interface. Primitive arrays become string[], number[] and so on; mixed values become unions.

### Why are some fields optional?

A key missing from at least one object in an array is optional in the merged type, because it is not guaranteed in every item.

## Related tools

- [JSON Formatter](https://dev.eneawork.it/json-formatter)
- [JSON Diff](https://dev.eneawork.it/json-diff)
- [CSV to JSON](https://dev.eneawork.it/csv-to-json)

## Machine-readable

- Tool catalogue: https://dev.eneawork.it/tools.json
- Full AI context: https://dev.eneawork.it/llms-full.txt
- Privacy: https://dev.eneawork.it/privacy
- This page in HTML: https://dev.eneawork.it/json-to-typescript
- Italian version: https://dev.eneawork.it/it/json-to-typescript
