JSON to Python
NewGenerate Python TypedDict or dataclass definitions from JSON data.
Frequently Asked Questions
What is the difference between TypedDict mode and dataclass mode?
TypedDict mode emits typed dictionary classes only. Turning on dataclasses adds @dataclass classes instead, and nullable fields get = None defaults.
When does it use Optional[...]?
Only when the sampled value is actually null. A key that is present in one sample object and missing in another array item is not turned into Optional automatically.
How are arrays inferred?
Array item schemas are merged across all elements, so int + float becomes float and incompatible shapes can degrade to Any. Empty arrays still become a List[...] shape, but with Any as the fallback item type.
What happens with empty objects or non-object roots?
An empty object falls back to Dict[str, Any]. A root array or primitive becomes a type alias instead of a class.
Will nested objects get their own Python types?
Yes. Nested objects generate dedicated Python types named from their path, rather than staying inline.