Python Dict / List to JSON
Converts a Python dict or list literal into JSON.
None → null, True → true, False → false.
Handles single-quoted strings and trailing commas. Nothing leaves your browser.
About This Tool
Parses Python dict/list literal syntax into JSON. Normalizes common Python collection reprs from debuggers or print() (OrderedDict, defaultdict, Counter, and tuple/set/frozenset literals) into plain dict/list structures.
For the reverse direction, turning JSON into a Python literal you can paste into code, use JSON to Python Dict / List.
Key Features
- Collection-repr normalization: OrderedDict, defaultdict, Counter, tuple, set, and frozenset literals convert to plain dict/list before parsing.
- Variable-assignment stripping: Paste data = {...} directly; the leading assignment is detected and removed.
- Live conversion: Output updates on every keystroke, plus Convert button and Ctrl/Cmd+Enter.
- File upload: Load a .py or .txt file directly via the Upload button.
- One-click swap: The swap button sends the JSON output to JSON to Python Dict / List.