

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Still calibrating
click for more info
Not enough gems
Cost: 6 gems
1: JSON Syntax
incomplete
2: JSON Review
incomplete
3: Sending JSON
incomplete
4: Parsing JSON
incomplete
5: XML
incomplete
6: Why Use XML?
incomplete
This lesson's interactive features are locked, please to keep using them
The json.loads() function in Python takes a JSON string as input and constructs a Python object (dictionaries and lists) from the string. This allows us to work with the JSON as native Python objects!
import json
json_string = '{"title": "Avengers Endgame", "rating": 4.7, "in_theaters": false}'
obj: dict[str, str | float | bool] = json.loads(json_string)
print(obj["title"])
# Avengers Endgame
It's common for developers to write local tests using mock (or fake) data that looks like real data. Let's ensure that the JSON format the backend devs at Jello handed us is valid JSON! It would be a shame to write a bunch of code only to find out the format is wrong.
Complete parse_project function: