Question: I am trying to parse through a JSON file so I can only display the outputs for the UID : 268435471, ID : PLAYER13, and
I am trying to parse through a JSON file so I can only display the outputs for the "UID" : 268435471, "ID" : PLAYER13, and "NAME" : Poptart. I have created the code below and so far it is able to pull out all information but I do not know how to only display the name of Poptart or 268435471. Which commands should I use to only print what I need?


"0268435471" : { "UID": 268435471, "ENTITY_TYPE": "ObserverEntity", "ID": "PLAYER13", "NAME": "Poptart", "STEAMID": "76561197984279756", "XCAMERA": 0.0, "YCAMERA": -599.0, "CAMERA ZOOM_LEVEL": 0.5, "XCURSOR": 348.0, "YCURSOR": 262.0 import json 2 3 f = open('5458912363.json', 'r') data json.load(f) 4 5 6 7 frames = data['frames'] #entre frames [0268435471) #print Centre 8 9 10 11 12 13 14 15 16 for frame in frames: #printStype (frameL'Entities')). #print(frame[Dataversion: 1). entities = frame['Entities'] for entity in entities.keys(): print(entity) print(entities[entity]) entry = entities[entity] for property in entry.keys(): print (property) print(entry[property]) if "NAME" in entry.keys(): if ["NAME"] "Poptart": print("Poptart") 17 18 19 20 21 22 23 24
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
