How to Work with JSON data in Python: Read, Write, and Use APIs (Full Tutorial)

Опубликовано: 17 Май 2026
на канале: Pybeginners
92
6

In this Python tutorial, you’ll learn how to work with JSON (JavaScript Object Notation), a lightweight and widely-used data format for data exchange.

What you'll learn:
✅ How JSON works and its structure
✅ Converting JSON strings to Python dictionaries with json.loads()
✅ Writing Python objects to JSON with json.dump()
✅ Reading JSON files with json.load()
✅ Real-world API example using ExchangeRate-API to convert currency 💱

We also walk through practical use cases, including modifying JSON files, formatting output, and removing specific fields like area_code.

✅ This is a perfect tutorial for beginners and developers who want to understand how to use JSON for APIs, configuration files, and data pipelines.

data_initial = {
"states": [
{"name": "São Paulo", "abbreviation": "SP", "area_code": 11},
{"name": "Rio de Janeiro", "abbreviation": "RJ", "area_code": 21},
{"name": "Minas Gerais", "abbreviation": "MG", "area_code": 31},
{"name": "Bahia", "abbreviation": "BA", "area_code": 71},
{"name": "Paraná", "abbreviation": "PR", "area_code": 41}
]
}

✅ Article: https://www.pybeginners.com/python-li...

📘 Python Exercises for Beginners – Practice and improve your skills!
🔗 Access here: Learn Python the Practical Way https://pybeginners.gumroad.com/l/uhwwln