JSON to Python Converter

Convert JSON data into Python dictionaries and data structures. Automatically converts JSON types to their Python equivalents.

Auto-converts live as you paste or type (or press Ctrl+Enter)

1
Output will appear here...

How JSON maps to Python

Python has excellent built-in JSON support via the json module. When you call json.loads(), JSON types map directly to Python types. However, if you want to embed JSON data directly in a Python script as a literal dictionary, the syntax differs in a few important ways.

This converter handles the key type mapping differences:

JSONPython
trueTrue
falseFalse
nullNone
"string""string"
42 / 3.1442 / 3.14
{"key": "val"}{"key": "val"}
["a", "b"]["a", "b"]

How to use

  1. Paste your JSON into the input editor.
  2. Click Convert to Python.
  3. Copy the Python dictionary output into your script.

Example conversion

JSON input:

{
  "name": "Alice",
  "active": true,
  "score": 98.5,
  "tags": ["python", "dev"],
  "meta": null
}

Python output:

data = {
    "name": "Alice",
    "active": True,
    "score": 98.5,
    "tags": ["python", "dev"],
    "meta": None
}

When to use this converter vs json.loads()

In most production code, the right approach is to read JSON at runtime using Python's json.loads() or json.load() functions. This converter is most useful when you want to:

  • Embed static data directly in a Python script or test file
  • Quickly create a Python dictionary from a JSON snippet during development
  • Generate a fixture or seed data file for a Python application

Related Tools