Working on a small project that returns JSON on API call. However, I seem to be unable to obtain the values from the string. I can print the JSON but cannot seem to obtain individual elements.
I have tried json.loads() to ensure I am operating on a JSON object. To access the value associated with the "faceId" key, I tried the following but to no avail:
data = response.read()
dataStream = json.dumps(data)
faceIdentification = dataStream[0]['faceId']
I also attempted:
faceIdentification = dataStream['faceId']
and
faceIdentification = dataStream['faceId'][0]
I also tried directly operating on the JSON received but no luck. The JSON I want to obtain the faceId's value from is:
[{"faceId":"52f388ad-6789-4657-af4d-0dc308cc9aaa","faceRectangle":{"top":237,"left":204,"width":226,"height":226}}]
json.loads()notjson.dumps()