Sep-24-2018, 04:11 PM
I fixed your json, since what you posted isn't valid. So the path to the
Also, after this post, I'm going to move the thread somewhere more applicable, since this has nothing to do with Python News lol
id
might not be the same as whatever the real data is. This should be enough to get you going in the right direction, though.Also, after this post, I'm going to move the thread somewhere more applicable, since this has nothing to do with Python News lol
>>> import json >>> text = ''' ... { ... "Attributes": { ... "accessories": [], ... "age": 32.0, ... "blur": { ... "blurLevel": "low", ... "value": 0.11 ... }, ... "occlusion": { ... "eyeOccluded": false, ... "foreheadOccluded": false, ... "mouthOccluded": false ... }, ... ... "Id": "c8c21d40", ... "faceRectangle": { ... "height": 154, ... "left": 477, ... "top": 144, ... "width": 154 ... } ... } ... } ... ''' >>> parsed = json.loads(text) >>> parsed {'Attributes': {'accessories': [], 'age': 32.0, 'blur': {'blurLevel': 'low', 'value': 0.11}, 'occlusion': {'eyeOccluded': False, 'foreheadOccluded': False, 'mouthOccluded': False}, 'Id': 'c8c21d40', 'faceRectangle': {'height': 154, 'left': 477, 'top': 144, 'width': 154}}} >>> parsed['Attributes']['Id'] 'c8c21d40'