ARZENTIQ
DEVELOPER & DATA

JSON to TypeScript Types

Infer TypeScript interfaces or type aliases from a JSON sample: nested objects named from their keys, array elements merged into optional and union members.

A declaration block you can paste — one interface per distinct shape, optional and union members where the sample varies, unknown[] for empty arrays — with the sample’s limits stated.

Example: Two users, one with name null and an address without zip, become interface User { id: number; name: string | null; tags: string[]; address: Address } with zip?: string in Address.

v0.1.0 · last reviewed 20 September 2026
Loading the workspace…
BUILT TO BE UNDERSTOOD

Shapes from a sample,
with the gaps named.

How shapes are inferred and named, how arrays are merged, and what a sample cannot tell.

Inference

Every object becomes an interface named from its key in PascalCase (array elements are singularised: users → User; the root takes the name you give). Primitives map to string, number, boolean and null; identical shapes share one declaration.

Merging arrays

All elements of an array are merged into one shape: a key present in some elements but not others becomes optional, a key holding different types becomes a union (null included), and an empty array is unknown[] because the sample says nothing about its elements.

What a sample cannot say

A key absent from every element is not declared, an integer-only field is still number, and string enums are not detected. The output is a starting point to refine, not a contract. Nothing leaves the browser; the same four anonymous usage counts as the rest of the site apply.

SOURCES

  • Structural inference from a sample (shape merging with optional and union widening); TypeScript interface and type alias syntax; naming by PascalCase key with simple singularisation

Last reviewed 20 September 2026. How results are checked: How we verify.