How to grab values from key:value pairs in parsed JSON in Python
I am trying to extract data from a JSON file. Here is my code. import json json_file = open('test.json') data = json.load(json_file) json_file.close() At this point I can print the file using print data and it appears that the file has been read in properly. Now I would like to grab a value from a key:value pair that is in a dictionary nested within a list nested within a dictionary (Phew!). My initial strategy was to create a dictionary and plop the dictionary nested within the list in it and then extract the key:value pairs I need. dict = {} dict = json_file.get('dataObjects', None) dict[0]
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.