JSON to Python Dataclass Converter

BeanTrans transforms JSON into strongly typed Python 3.7+ @dataclass models (or plain Python classes) with snake_case attributes, Optional[T] annotations, and List[T] hints directly in browser memory.

Key Capabilities

  • Generates Python 3.7+ @dataclass classes with PEP 484 type hints out of the box.
  • Switch between @dataclass and standard __init__ Python classes in the Config panel.
  • Converts snake_case and nested JSON structures into cleanly ordered Python classes.

Type Mapping Reference

Source Target Notes
stringstrPython str
integerintPython arbitrary-precision int
decimalfloatPython float
booleanboolPython bool
array<T>List[T]Typed list annotation

Frequently Asked Questions

Can I generate plain Python classes instead of @dataclass?
Yes. Open the Config drawer at the bottom and uncheck Use @dataclass under Python.
Does BeanTrans support converting SQL DDL or Java classes into Python dataclasses?
Yes. Because BeanTrans uses a unified 9x9 AST engine, you can set Source to SQL DDL, Java, Go, Rust, or TypeScript and output Python directly.
Is my JSON data kept private?
Yes. Parsing and code generation execute 100% locally in your browser.