Launch offer
Business website $150 USD Custom plugin $200 USD Ready in 5 days
Get a quote
Python

Working with JSON in Python

Serialize and parse JSON with the json module for APIs and config files.

Working with JSON in Python — a practical guide to Python JSON with clear examples you can reuse in real projects.

Python Tutorial Series (41/95). Prefer one article? Read the complete Python tutorial.

Short description

JSON maps naturally to Python dicts/lists. Use `json.dumps` / `json.loads` and file helpers.

JSON encode/decode

import json

data = {'name': 'Asha', 'skills': ['python', 'sql']}
text = json.dumps(data, indent=2)
print(text)
print(json.loads(text)['name'])

Leave a reply

Your email address will not be published. Required fields are marked *