Paste a JSON sample and get Pydantic v2 models (or plain dataclasses) with modern type hints: str, int, float, bool, list[...], X | None for nullable or optional fields, and nested classes defined before the classes that use them. Keys that aren't Python names become snake_case fields with a Field(alias=...) back to the original key.
The output is checked for valid Python syntax in the tests. It runs entirely in your browser.
Need a different language? See all JSON-to-code converters.
Found something broken, have an idea, or just want to say thanks about any of our tools? Every message reaches a real person.