Answer the question
In order to leave comments, you need to log in
How to iterate json array in python?
there is a response from api
data{
info{
product1{
prodinfo:1
}
product2{
prodinfo:2
}
product1{
prodinfo:3
}
}
}
Answer the question
In order to leave comments, you need to log in
resp = {
'data': {
'info': {
'product_1': {
'prodinfo': 1
},
'product_2': {
'prodinfo': 2
},
'product_3': {
'prodinfo': 3
}
}
}
}
products_key = [x for x in resp['data']['info'].keys()]
print(products_key)
products = []
for key in products_key:
products.append(resp['data']['info'][key])
print(products)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question