JSON to Python Dict Converter
Writes JSON out as a Python dict literal, with True, False, None and your choice of quotes.
Loading the tool…
How to use this tool
- Paste the JSON, or load a .json file with the picker.
- Give it a variable name to get an assignment, or clear the field for a bare literal.
- Choose the quote style and the indent your project uses.
- Select Convert to Python and copy the result straight into your module.
What json to python dict does
Going the other way is the more common errand: an API response or a config file is JSON, and you want it as a literal inside a Python module — a fixture, a default config, a test case. Pasting the JSON directly almost works, and then fails on the first null or true. This page rewrites it properly, so what comes out is valid Python you can paste without editing.
The output is shaped for a file rather than for a screen. Every collection gets a trailing comma, so adding an entry later touches one line in a diff instead of two. Strings use single quotes by default, which is what most Python formatters settle on, and double quotes are an option if that is your house style. Give it a variable name and the result comes back as an assignment, ready to paste; leave the name blank and you get the bare literal. The indent is yours to set, with four spaces as the default because that is the Python convention.