Generate:
JSON Input
TypeScript Interfaces
Convert JSON to TypeScript interfaces or Python dataclasses
Paste JSON and instantly generate matching TypeScript interfaces or Python dataclasses, including nested types. Skip the tedious manual typing of API responses — conversion runs locally in your browser.
Frequently Asked Questions
- How are nested objects handled?
- Each nested object becomes its own named interface (or dataclass), referenced from the parent — the same structure you would write by hand.
- What TypeScript types do JSON values map to?
- Strings map to string, numbers to number, booleans to boolean, arrays to T[], and null to null. Fields that could vary should be widened manually after generation.
- Can one JSON sample capture optional fields?
- No — a single sample cannot show which fields are sometimes absent. Mark those properties optional (field?: type) after generation based on your API contract.
- Why dataclasses instead of plain Python dicts?
- Dataclasses give you attribute access, type hints for your IDE and mypy, and constructor validation — dicts give you none of that.