JSON to Python
About this tool
Paste a JSON object such as name and age to get a typed class User. Use the online cURL generator when you need an HTTP command.
Features
- Emits a class with annotations
- Splits nested objects into extra classes
- Infers list and dict from the sample
How to use
- Paste a JSON sample and set the class name, for example User.
- Review the generated class and str / int / list annotations.
- Copy the class into a Python file.
When to use it
- A script needs a typed view of a JSON config
- A starting point for pydantic or a plain class
- Mixed types in the sample still need a manual pass
Examples
- {"name":"Tom","age":20} yields name: str and age: int.
- {"tags":["a"]} marks tags as a list.
FAQ
Is the JSON uploaded?
No. Generation stays in the browser.
How is this different from the online cURL generator?
This page builds a Python class from JSON. The online cURL generator turns an HTTP request into a curl command.
Back to JSON Tools Hub