Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Access a json field in python

Im using a get request in python

x = requests.get(url, headers = ... ) 
print(x.json())

and the result im getting is

{
'organization': {
'id': '6', 
'name': 'TestPostman', 
'displayName': 'TestPostman', 
'canHaveGateways': True, 
'maxGatewayCount': 0, 
'maxDeviceCount': 0
},
'createdAt': '2022-05-10T18:07:49.327175Z', 
'updatedAt': '2022-05-10T19:44:09.667978Z'
}

How can i access any of the organization’s fields ?
I tried x.organizzation[‘id’] but does not work .

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

If you want to access the ID in the Organization try this:

x = x.json()
print(x["organization"]["id"])
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading