Variable name: Indent:
Input JSON 0 chars
Python Output 0 chars
Python code will appear here…
Ready — paste JSON and click Convert

JSON → Python Conversion Reference

nullNone
trueTrue
falseFalse
{…}dict {…}
[…]list […]
"string""string"
123 / 1.5int / float

Why JSON isn't valid Python

JSON and Python look similar but have key differences: JSON uses lowercase null, true, and false, while Python uses None, True, and False. Pasting raw JSON into Python raises a NameError on those values. This converter handles all three substitutions automatically, so the output is always valid Python.

You can also use Python's built-in json.loads() to parse JSON strings at runtime — but when you need a hardcoded dict in your source code, this converter gives you the exact syntax you need.