Skip to content
Advertisement

How would you filter through a JSON file and pick out the relevant keys in Python 3.9.x?

I am trying to filter through an API (JSON format). I am pretty new to this and have no idea where to start. For simplicity’s sake, I will only give part of the API output I would technically get. I am using Python 3, specifically Python 3.9.2.

JavaScript

The output I would like is something like the following:

JavaScript

As you can see, I am removing some of the contents. How can I accomplish this? Any pointers would be appreciated. Thanks in advance!

Advertisement

Answer

Let’s say your file with json data is named api_data.json.

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement