Reading and Writing JSON Data in Python


Use the json module to serialize and deserialize JSON data.

Source Code

import json
data = {"name": "John", "age": 30}
json_string = json.dumps(data)
print(json_string)
data = json.loads(json_string)
print(data)
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments