Help Iterate Python - Json file

Can you help me iterate over this Json file ?to have the ‘name’

{
“data”: [
{
“circulating_supply”: 18556575,
“cmc_rank”: 1,
“date_added”: “2013-04-28T00:00:00.000Z”,
“id”: 1,
“last_updated”: “2020-11-28T10:13:02.000Z”,
“max_supply”: 21000000,
“name”: “Bitcoin”,
“num_market_pairs”: 9550,
“platform”: null,
“quote”: {
“USD”: {
“last_updated”: “2020-11-28T10:13:02.000Z”,
“market_cap”: 315363411475.37506,
“percent_change_1h”: -0.09085874,
“percent_change_24h”: -0.96244779,
“percent_change_7d”: -9.13456398,
“price”: 16994.69926294993,
“volume_24h”: 33228610555.180286
}
},
“slug”: “bitcoin”,
“symbol”: “BTC”,
“tags”: [
“mineable”,
“pow”,
“sha-256”,
“store-of-value”,
“state-channels”
],
“total_supply”: 18556575
},
{
“circulating_supply”: 113610761.999,
“cmc_rank”: 2,
“date_added”: “2015-08-07T00:00:00.000Z”,
“id”: 1027,
“last_updated”: “2020-11-28T10:13:02.000Z”,
“max_supply”: null,
“name”: “Ethereum”,
“num_market_pairs”: 5775,
“platform”: null,
“quote”: {
“USD”: {
“last_updated”: “2020-11-28T10:13:02.000Z”,
“market_cap”: 58243018219.506546,
“percent_change_1h”: -0.60192432,
“percent_change_24h”: -0.43129336,
“percent_change_7d”: -0.74002835,
“price”: 512.6540584246693,
“volume_24h”: 14370965359.007776
}
},
“slug”: “ethereum”,
“symbol”: “ETH”,
“tags”: [
“mineable”,
“pow”,
“smart-contracts”
],
“total_supply”: 113610761.999
}
]
}

Hi @vincentmathilde9

Try this

#import json
Import json

#assign json data to a variable:  json_str
json_str = "valid json string"

#parse JSON string to python dict: json_dict
json_dict = json.load(json_str)

#we have a valid dictionary, let's iterate. (You could enclose the following within try-except blocks  to handle errors)
#iterate through your the dictionary, json_dict
for data in json_dict:
    #we now have access to the dictionaries keys and their values, lets loop through the values
    for elem in json_dict[data]:
        #the value is an array of dictionaries, lets loop through each dictionary looking for the name key-value pair
        for key in elem:
            if key == "name":
                #we now have the name key-value pair,  do what you want with it here
                print(elem[key])