Skip to main content
Programming Language Tools

Python JSON Formatter

Format JSON or Python dict-literal syntax (single quotes, True/False/None) into clean, standard JSON.

Paste JSON or a Python dict literal (with single quotes and True/False/None) below - this tool normalizes it into standard, formatted JSON.

Python dict literals use True/False/None and allow single-quoted strings - both differ from strict JSON syntax, which this tool normalizes automatically.

Why Is This Different from a Regular JSON Formatter?

Python's dict literal syntax looks almost like JSON but differs in a few ways: it allows single-quoted strings, and uses True/False/None instead of JSON's lowercase true/false/null. This tool normalizes those differences automatically.

Why Use This Tool?

Printing a Python dict (e.g. via print(my_dict)) produces this Python-flavored syntax, not strict JSON - pasting it into a standard JSON formatter would fail. This tool handles the conversion.

How to Use It

  1. Paste JSON or a Python dict literal.
  2. Click Format.
  3. Copy the resulting standard, formatted JSON.

Limitations

This handles standard Python dict literal syntax - Python-specific values with no JSON equivalent (like tuples, sets, or custom objects) aren't representable and will cause a parse error.

Frequently Asked Questions

They look similar, but Python uses single quotes, True/False and None, while JSON requires double quotes, true/false and null.

print(dict) uses Python's repr format. Use json.dumps(data) in Python to produce valid JSON directly.

No. JSON has no equivalent for them. Convert them to lists first.
Share this tool: