Answer the question
In order to leave comments, you need to log in
[[+content_image]]
Get the data of the text field, by the value of the data field in json?
I get a string
jsonStok = {'stock': [[{'data': 'ct02', 'text': 'артикул1'}], [{'data': 'ct04', 'text': 'артикул2'}], [{'data': 'ct06', 'text': 'артикул3'}]}
for art in jsonStok['stock']:
if smth['data'] == 'ct02':
print smth['text']
break
Answer the question
In order to leave comments, you need to log in
def text_by_data(data, value):
for x in data['stock']:
for y in x:
if y['data'] == value:
return y['text']
print text_by_data(jsonStok, 'ct02')
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question