DevConvert
Python

Python Dict to JSON Converter

How to convert Python dictionary output (with True/False/None) to valid JSON.

3 min readJanuary 2026

Python dictionaries look similar to JSON but have key differences that make them invalid JSON. When you print a Python dict or copy output from a Python REPL, you'll see:


{'id': 1, 'name': 'Rohith', 'active': True, 'score': None}


This is not valid JSON because:

- Python uses single quotes `'` instead of double quotes `"`

- Python booleans are `True`/`False` (capitalised) vs JSON `true`/`false`

- Python uses `None` vs JSON `null`


Example


Input (Python Dict):

{'id': 1, 'name': 'Rohith', 'active': True, 'verified': False, 'score': None, 'tags': ['python', 'dev']}


Output (JSON):

{

"id": 1,

"name": "Rohith",

"active": true,

"verified": false,

"score": null,

"tags": ["python", "dev"]

}


When You Need This


- Converting Django model `__dict__` output for APIs

- Debugging FastAPI or Flask responses

- Sharing Python data with JavaScript front-ends

- Logging structured data


DevConvert auto-detects Python dict syntax and handles all the conversion automatically.


Try it now

Use DevConvert to instantly convert your Python data. No signup required.