Language
English

Dict Formatter

Python Dict formatting and beautifying

Input
Paste Python Dict or JSON text here...
Output
Formatted result will appear here...

togotools.top technical reference

Technical reference

Convert Python dict literals to JSON locally in your browser. Supports single-quoted strings, unquoted keys, True/False/None, and trailing commas. Output features syntax-highlighted JSON.

Core features

  • Parses Python dict literals, compatible with single quotes, unquoted keys, True/False/None syntax.
  • Outputs formatted JSON with syntax highlighting (keys, strings, numbers, booleans color-coded).
  • Configurable indent width and optional key sorting.
  • Live statistics: key count, node count, max depth, and type distribution.

Example: before and after

Python True/False/None auto-convert to JSON true/false/null. Single-quoted strings and unquoted keys are normalized automatically.

python
{'name': 'Ada', 'age': 30, 'active': True, 'tags': [1, None, 'mixed']}

{
  "name": "Ada",
  "age": 30,
  "active": true,
  "tags": [1, null, "mixed"]
}

Limits

  • Only supports Python dict and list literals, not full Python syntax (expressions, function calls).
  • Trailing commas are tolerated without errors.
  • Input must be a single complete dict or list; multi-statement blocks are not supported.

Frequently asked questions

Why does my Python dict fail to parse?

Common causes include Python expressions (variable references), multi-statement indentation errors, or unsupported syntax like sets and tuples. Only literals are supported.

Can it convert JSON to Python dict?

Only Python dict to JSON direction is supported. JSON is already valid Python dict syntax and can be used directly.