JSON to Python

Generate Python dataclasses from JSON.

Frequently Asked Questions

What Python version do the generated dataclasses require? +
The output requires Python 3.7 or later, which introduced the dataclasses module. The typing imports (Optional, List) are available from Python 3.5+.
How are field names converted to Python style? +
CamelCase and PascalCase keys are converted to snake_case. For example, firstName becomes first_name and userID becomes user_id.
Does the from_dict method handle nested objects? +
Yes. The generated from_dict method recursively creates instances of nested dataclasses. It also handles lists of nested objects by mapping each item through the child class constructor.