import json data = ''' [ { "id" : "001", "x" : "2", "name" : "Quincy" } , { "id" : "009", "x" : "7", "name" : "Mrugesh" } ] ''' info = json.loads(data) print(info[1]['name'])
The code block above imports the json module and uses json.loads() to process the data. The json.loads() function converts a string that contains json data into a list. In this case, it converts the string data into a list of 2 dictionaries. To access the information we need, we access the list using info[1], since info is the name of the list, and then access the second dictionary in the list using the ["name"] key.