In python, I am getting a JSON from an API call.
resp = requests.get(url)
resp.json()
I am going to use my MySQL vocabulary. This object I get is huge, with irregular structure (not all fields are available for each entry).
So I want to select in this JSON some fields and some entries based on values.
Let's say that the JSON returns profiles of users, with the fields "name"
, "email"
, and "age"
.
I want to create a new small JSON having:
- Only one field "email" - we remove the entries not having an email field.
- Only when
"age"
=15
While in SQL I would do it in 30 seconds, I haven't found how to do it in Python...