Nearby lessons
103 of 108Python - JSON Guide
What Is JSON?
JSON stands for JavaScript Object Notation and is a lightweight format for data exchange.
Why JSON Is Required
- APIs
- Web applications
- Configuration files
- System-to-system data exchange
json Module
Python provides the built-in json module.
import jsonConverting Python to JSON
import json
student = {'name': 'Rahul', 'age': 25}
print(json.dumps(student))Converting JSON to Python
import json
data = '{"name":"Rahul","age":25}'
print(json.loads(data))JSON Files
Use json.load() to read from a file and json.dump() to write to a file.
🧠 Test Your Knowledge
3 QuestionsProgress: 0 / 3
Keep Going!Python - Regular Expressions