How to extract data from a JSON object in Python?

I am trying to extract data from a JSON object that is returned from the api call for api.trends () [Tweepy], but I cannot extract the data.

Can someone give me an example of how to retrieve data from a JSON object. I want to extract data in tabular form.

Thanks in advance.

+4
source share
1 answer

Once you run it, but json.loads() , it will become a regular Python object. Just index it, like any file or list.

 >>> json.loads('{"foo": 42, "bar": "baz"}')[u'bar'] u'baz' 
+10
source

All Articles