Codec64

Python Literal to JSON Converter

Your data stays in this browser.

Convert dictionaries from Python PDB or print output into JSON.

SourcePython literal
1 line31 bytesUTF-8
Target
JSON
4 lines37 bytesUTF-8

How to convert a Python dict to JSON

  1. Paste a dictionary or list copied from print() output or the PDB debugger.
  2. Choose Python literal as source and JSON as target, or swap them to get Python back.
  3. Select Convert, then copy result.

Parsed, never executed

The converter reads a limited literal grammar and never calls Python or eval. String keys, nested dictionaries, lists, tuples, finite numbers, booleans, and None are supported. Sets, bytes, function calls, and other expressions are rejected.

Python literal vs JSON syntax

Python literal values and their JSON equivalents
PythonJSON
True / Falsetrue / false
Nonenull
'text'"text"
(1, 2)[1, 2]

JSON requires double-quoted keys and strings. Tuples become arrays, so converting back yields a list.