How the types are inferred
The generator reads your sample and infers a type for every field: strings, integers and decimals, booleans, nested objects (each gets its own named Python type) and arrays. If an array holds several objects, all of them are merged โ fields missing from some items become optional and fields that are sometimes null become nullable, so one representative response is usually enough. Field names that arenโt valid identifiers are converted and mapped back to the original JSON key.
Using the Python code
Pydantic models validate data at runtime and handle the camelCase-to-snake_case mapping through Field(alias=โฆ): Root.model_validate(data). Dataclasses are part of the standard library and lighter, but donโt validate or convert nested dictionaries on their own. Classes are written in dependency order (nested classes first) and optional fields come last with = None, as Python requires. Type hints use modern list[...] syntax (Python 3.9+).
Everything runs in your browser โ your code and data are never uploaded, so it is safe to paste private config files and API responses.
Frequently asked questions
Dataclass or Pydantic?
Pydantic for parsing and validating API data; dataclasses for simple internal structures.
Why are field names snake_case?
Thatโs Python convention; the original JSON key is kept as an alias or comment.
Which Python version is needed?
Python 3.9+ for list[...] hints; Pydantic v2 for the BaseModel output.
Last updated 2026-11-21 ยท Built by Vinayak Agarwal ยท Part of Developer & Web (77 tools)