how to retrieve the list value of json file in python

Solutions on MaxInterview for how to retrieve the list value of json file in python by the best coders in the world

showing results for - "how to retrieve the list value of json file in python"
Louis
26 Aug 2017
1for key, value in json_data.iteritems():
2    print key
3    if isinstance(value, (list, tuple)):
4        for item in value: 
5            print item
6    if isinstance(value, (dict)):
7        for value_key,value_value in value.iteritems(): 
8            print value_key,str(value_value)
9
Stefano
31 Jul 2018
1json_data = [] # your list with json objects (dicts)
2
3for item in json_data:
4    for data_item in item['data']:
5        print data_item['name'], data_item['value']
6