How to extract data from JSON Object in Python?

18,829

Once you run it though json.loads() it becomes normal Python objects. Simply index it as you would any dict or list.

>>> json.loads('{"foo": 42, "bar": "baz"}')[u'bar']
u'baz'
Share:
18,829
nik2702
Author by

nik2702

Updated on June 12, 2022

Comments

  • nik2702
    nik2702 almost 2 years

    I am trying to extract data from JSON Object which is returned from the api call for api.trends() [Tweepy] but I am not able to extract the data.

    Can anyone give me an example of how to extract data from JSON object. I want to extract the data in tabular form.

    Thanks in advance.