All the doc I find online relies on a for
loop to navigate in a json in Python. Is there no other faster choice to perform the following action? Something like myjson["values"][:]["id"]
?
Thanks.
MWE:
import json
myjson = json.loads(str('{"total" : 3, "values" : [{"id": 10100,"name": "extra name"},{"id": 10101,"name": "awesome name"},{"id": 10102,"name": "strange name"}]}'))
# I want to print the json's id's, only method?
for i in myjson["values"]:
print(i["id"])