gizmobench
BrowseDaily

JSON to TypeScript Interfaces

This page opens Samples input and TypeScript output with type-only generation selected. Paste a JSON object, an array of records or multiple documents, then Generate types. Missing properties become optional and explicit nulls remain nullable. Nested objects produce interfaces, and non-identifier keys keep their JSON spelling. Load example gives two records with different fields so you can inspect the generated union and optional-property report.

Your JSON

TypeScript options

Generated source

Missing keys become optionalNull values become nullableEvery JSON key kept, renames listed

Paste JSON samples or a JSON Schema, then generate Dart or TypeScript.

Language
TypeScript
Root type
None yet
Classes
0
Fields
0
Warnings
0

Common questions

How are missing properties and null values represented?
A property missing from one sample becomes optional with ?. A property present with null becomes a union including null. Several samples can reveal both conditions. A type inferred from examples cannot guarantee the shape of future API responses.
Does it support nested JSON objects and arrays?
Yes. Nested record objects can become separate interfaces. A top-level array is treated as a collection of examples for its record type. Data-like keys may become an index signature when the maps option is enabled; the report identifies loose inference.
Can I use JSON Schema or runtime parsing helpers instead?
Switch to Schema to use declared properties and required fields, or enable Runtime-checked Convert helpers to generate parsing code. This page starts with samples and interfaces only. It does not convert TypeScript source back to a schema or install an npm library.

Sample inference cannot know absent fields or all future types. No execution or automatic API calls.