Loading…
JSON (JavaScript Object Notation) is a common data format.
import jsonJSON string to Python
json_str = '{"name": "Alice", "age": 25}'
data = json.loads(json_str)
print(data["name"]) # AlicePython to JSON string
person = {"name": "Bob", "age": 30}
json_output = json.dumps(person)
Parse this JSON and print the total price of all items.
json_data = '[{"item": "Book", "price": 15}, {"item": "Pen", "price": 2}, {"item": "Notebook", "price": 8}]'
Downloading Python… (one-time, ~10 MB)
This runs entirely in your browser and is cached for next time.