October 2019
Beginner to intermediate
674 pages
16h 43m
English
Let's have a look at a new JSON file:
with open('product.json') as json_string: d=json.load(json_string) d
We get the following output:

This is a JSON with several degrees of nesting. The hits key contains a JSON as a value whose key value is hits. The value of this JSON is a list containing another JSON.
Let's say that we want to find out the score value from this JSON:
d['hits']['hits'][0]['_score']
Similarly, the image URL can be found as follows:
d['hits']['hits'][0]['_source']['r']['wayfair']['image_url']
Read now
Unlock full access