JSON to TypeScript Interface
Generate TypeScript interface or type definitions from JSON. Handles nested objects, arrays, and null values.
Generate Python dataclass definitions from JSON. Supports nested objects, arrays, Optional types, frozen, slots, and from_dict() method generation.
This tool generates Python @dataclass definitions from JSON — perfect for quickly typing API responses, configuration files, or any JSON data structure.
Nested objects are expanded into separate named dataclasses, arrays are typed as List[T], and all classes are output in dependency order. The generated file includes from __future__ import annotations for forward references, and supports Optional types, frozen, slots, and from_dict() helpers for real-world use.
Each nested object is converted into its own dataclass and referenced using forward references (string annotations). The generated file includes `from __future__ import annotations` so it works out of the box.
JSON keys are automatically converted to Python snake_case. For example, `firstName` becomes `first_name`.
Arrays are typed as `List[T]`. For arrays of objects, all keys across all elements are merged into a single dataclass and output as `List[ClassName]`.
Null fields are generated with a default value of `None`. Due to Python's dataclass rules, fields with defaults are always placed after fields without defaults.