S
S
Sergey Kopytoff2020-09-17 13:00:32
Python
Sergey Kopytoff, 2020-09-17 13:00:32

Python+1c+Odata+Json parsing?

Good day, gentlemen! There is a small problem, namely when parsing json from python.
there is such a file yason.
there is this code:

import server
import requests
import json

#обращаемся к серверу с запросом
zapros = requests.get(server.server , auth=(server.login , server.password))
jsonDATA = json.loads(zapros.text)
print(jsonDATA['value'])

And everything seems to be fine) but inside the 'value' key, as you saw from the json file, there are exactly the keys I need) for example:
"Code": "840",
"Description": "USD",
and of course I can't parse them directly . please explain what is the problem? how to parse tags inside tags? or in my case keys-within-keys?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Denis Melnikov, 2020-09-17
@777admin777

jsonDATA['value']['code']

S
soremix, 2020-09-17
@SoreMix

for data in jsonDATA:
    print(data['Code'])
    print(data['Description'])

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question