json

Stdlib — SerializationPython 2.6+Beginner

Encode and decode JSON data

Quick Info

Documentation
Official Docs
Python Version
2.6+
Dependencies
None — Python Standard Library
Install
Included with Python

Learn by Difficulty

Quick Example

python
import json

# Convert Python to JSON
data = {"name": "Python", "version": 3, "features": ["easy", "powerful"]}
json_str = json.dumps(data, indent=2)
print(json_str)

# Convert JSON to Python
parsed = json.loads(json_str)
print(parsed["name"])

The json module is part of Python's standard library. Encode and decode JSON data.

Try in Playground

Tags

stdlibserializationdata-formatwebfile-io

Related Items