I have a response from API where JSON is not in an array, something like below
{
"TV": {
"USD": 9677.25,
"EUR": 7768.87,
"JPY": 1072773.87,
"GBP": 6898.93,
"AUD": 12294.15,
"CAD": 12056.19
},
"Lamp": {
"USD": 231.35,
"EUR": 185.89,
"JPY": 25735.85,
"GBP": 168.82,
"AUD": 296.7,
"CAD": 283
}
}
if it is array I can use .map function, but in this scenario how can I display data while looping it as data coming from API might be different on every call.
desired format that i am looking for is
[{
"PRODUCT": "TV",
"PRICE": {
"USD": 9677.25,
"EUR": 7768.87,
"JPY": 1072773.87,
"GBP": 6898.93,
"AUD": 12294.15,
"CAD": 12056.19
}
}, {
"PRODUCT": "Lamp",
"PRICE": {
"USD": 231.35,
"EUR": 185.89,
"JPY": 25735.85,
"GBP": 168.82,
"AUD": 296.7,
"CAD": 283
}
}]
Please help..