JSON to Python Dict Converter
Paste JSON and get a ready-to-paste Python literal you can drop straight into a script. Objects become dicts, arrays become lists, and the JSON keywords true, false and null are rewritten as Python's True, False and None. Strings keep single quotes by default, with backslashes, quotes and newlines escaped so the literal parses cleanly.
How to convert JSON to a Python dict
- Paste or type your JSON into the JSON input box, or click Load sample to see a worked example.
- Open the Quotes menu and pick Single (Python's usual style) or Double.
- Set Indent to 2 spaces or 4 spaces to match your codebase.
- Read the formatted literal in the Python dict box below.
- Click Copy and paste it directly into your Python file.
Examples
Object with a list and null
{"name":"Ada","items":[1,2],"note":null}{
'name': 'Ada',
'items': [
1,
2,
],
'note': None,
}Booleans and a float become True, False and a number
{"x":1.5,"live":false,"note":null}{
'x': 1.5,
'live': False,
'note': None,
}Double-quote style with a nested list
{"tags":["a","b"]}{
"tags": [
"a",
"b",
],
}Frequently asked questions
Is my JSON uploaded anywhere?
No. The conversion runs entirely in your browser using client-side JavaScript, so your data never touches a server and never leaves your device. That makes it safe for config files, API responses and other sensitive payloads.
How are true, false and null converted?
They map to Python's True, False and None respectively. This is the core reason raw JSON is not directly valid as a Python literal: Python capitalizes its booleans and uses None instead of null.
Should I choose single or double quotes for strings?
Either is valid Python. Single quotes are the more common convention and the default here, matching tools like Black. Pick double quotes if your project standardizes on them or if your strings frequently contain apostrophes.
Is the output safe to paste into code?
Yes. Backslashes are doubled, the active quote character is escaped, and newlines, carriage returns and tabs inside strings become the \n, \r and \t sequences. The result is a literal that Python parses without a syntax error.
Can I read the output back with json.loads?
No. The output is Python source, not JSON, because of True, False, None and single quotes. To read it back at runtime use ast.literal_eval, which safely parses a Python literal, or paste it straight into your code as a value.
What happens to a top-level array?
A JSON array at the top level becomes a Python list rather than a dict. Every element is rendered recursively, so nested objects inside the array still turn into dicts with the same indentation rules.
How is indentation handled for nested structures?
Each level of nesting adds the indent width you chose (2 or 4 spaces). Dicts and lists print one entry per line with a trailing comma, which keeps deep structures readable and produces clean diffs in version control.
What if my JSON is invalid?
The tool tries to parse the input first. If it is not valid JSON, you get an error message describing the problem instead of a broken literal, so you can fix the source before copying.
Are numbers or floats changed?
Numbers pass through as their JSON text form, so 1.5 stays 1.5 and 42 stays 42. Python and JSON share the same numeric syntax for these cases, so no conversion is needed.
Learn more
- JSON vs Python dict: the differences that matter
Why a JSON string is not a valid Python dict, the exact keywords that differ, and how to read a Python literal back safely at runtime.
Related tools
JSON to PHP Array
Convert JSON to a PHP array online. Paste JSON and get a clean array() or short [] literal with correct nesting, quoting and types. Runs in your browser.
JSON to CSV
Convert JSON to CSV online. Paste an array of objects and get clean, spreadsheet-ready CSV with the right headers. Runs in your browser.
JSON Formatter
Format, validate and minify JSON online. Pretty-print with custom indentation, sort keys and catch syntax errors. Runs in your browser.
Air Fryer Converter
Convert any conventional oven recipe to air fryer settings. Lower the temperature by 25 F and cut the cook time by about 20 percent automatically.
Baker's Percentage Calculator
Turn a bread formula into grams with baker's percentages. Flour is 100 percent, enter water, salt and yeast percents to get weights and hydration.
Baking Pan Converter
Swap one baking pan for another and scale the batter to fit. Compares pan areas for round, square and rectangular pans and gives a batter scale factor.