Mar-02-2020, 09:42 AM
Hi
I've a problem with a json to print all my results.. Seems a stupid problem but..
If I do:
But I don't succeed to do what I want:
If I do:
My json is like this:
Alex
I've a problem with a json to print all my results.. Seems a stupid problem but..
r = requests.post( request_url, headers=headers, verify=True, auth=(api_login, api_password) ).json()In fact what I want to do is to iterate this json, grep "__name" value and count how many this value is present.
If I do:
# print (*r.items(), sep='\n')I can see all results.
But I don't succeed to do what I want:
If I do:
for key,value in r.items(): print (value[0]["attrs"]["__name"])I can see the first element but never all elements. (one line per line)
My json is like this:
{ "results": [ { "attrs": { "__name": "name1", "active": true }, { "attrs": { "__name": "name2", "active": true }, ....Thanks for help
Alex