pythonjsonformatter

Paste what you have.

Python dicts and JSON, rewritten here. True, None, tuples, and quotes included. Nothing leaves this browser.

  • Dicts and JSON
  • True, None, tuples
  • Stays in this browser

Convert

Ready when you are.

Processed

Converted history

The last 5 conversions stay in this browser. Open one to put it back in Input.

About

PYTHONJSONFORMATTER is a paste-and-convert tool for Python developers, other developers, and data students. Paste a Python dict or a JSON document. The page rewrites it in the other dialect.

To JSON accepts a Python dict or JSON and writes JSON. Click JSON → Python when you want Python out.

Conversion runs in this tab. There is no account and no upload to a server. Converted history is stored in this browser with IndexedDB.

What we rewrite

Python JSON
True / Falsetrue / false
Nonenull
'text'"text"
(1, 2)[1, 2]
{1, 2}[1, 2]
0x10, 1_00016, 1000
Trailing commas, # commentsSet aside

FAQ

How do I convert a paste?

Put text in Input. Choose a mode. Press Convert. Use Copy processed or Download processed when the right pane looks right.

What can I paste?

A Python literal (dict, list, tuple, set, True, False, None, comments, trailing commas) or a JSON document. f-strings and function calls are not literals, so those fail on purpose.

Does my JSON leave this computer?

No. Parsing and formatting run in the page. History is saved only in this browser.

Where is converted history?

In the Converted history section above. Each row shows Input and Processed. Open a row to load it back into the editor.

Why did a convert fail?

A red area names the line and column. Click it to jump there. Common causes are a missing comma, an unclosed quote, or a name that is not True, False, or None.

Shortcuts