user3188033 user3188033 - 1 year ago 46
JSON Question

how to pass json in python

I am using python and have a json response :

{u'outcomes': [{u'entities': {}, u'confidence': 0.951, u'intent': u'timeanddate', u'_text': u'what is the'}], u'msg_id': u'629bbdbd-788b-4418-a5cf-1f9a7895f490', u'_text': u'what is the'}

I would like to access the information like this or something similar:


How would I do this.

Thank You

Answer Source

Pay attention to the hierarchy. You'll notice the dictionary containing the intent key is nested in a list, so you'll have to index the list before you can access the dictionary:

#                    ^ --> dictionary is located at index 0 of the list