JSON to Python

Generates a Python @dataclass or TypedDict type definition from a JSON sample, or renders the JSON value itself as a Python literal, with null, true, and false correctly translated to None, True, and False.

Private by architecture: All processing is 100% client-side memory. Your data never leaves this browser tab.
JSON input
0 lines · 0 charsJSON
Python output
Ctrl/Cmd+Shift+C
0 charsPython

Example

{"id": 1, "name": "Ada", "active": true, "note": null}

produces (dataclass mode):

@dataclass
class Root:
	id: int
	name: str
	active: bool
	note: Optional[Any]

FAQ

Can I convert Python code/dicts back to JSON?
Yes! Click the ⇌ swap button or toggle the Direction dropdown to generate mock JSON from Python dictionaries, TypedDict, dataclass, or Pydantic models.
dataclass, TypedDict, or Python literal, which should I use?
@dataclass generates a real runtime class; TypedDict is a type-checking-only shape for plain dicts; Python literal skips types entirely and gives you the actual value as Python source.