DEVELOPER TOOL
Python ↔ JSON Converter
Convert Python dict/list literals to JSON, and back.
About this tool
Convert a Python dict/list literal — the kind you'd get from print(my_dict) or a scraped API response — into valid JSON, or the other way around. Handles single-quoted strings, True/False/None, tuples, nested structures, and Python comments.
Everything runs locally in your browser — nothing is uploaded.
Frequently asked questions
- Why isn't Python dict output valid JSON directly?
- Python's
repr()/print()output uses single quotes and the keywordsTrue,False, andNoneinstead of JSON's required double quotes andtrue/false/null— this tool translates between the two. - What happens to Python tuples?
- Tuples
(1, 2, 3)are converted to JSON arrays, since JSON has no separate tuple type. Converting JSON back to Python always produces lists, not tuples. - Does this evaluate f-strings or expressions?
- No — this parses static literals only, not executable Python. An f-string like
f"{x}"is read as a literal string containing the braces, not evaluated.