Forum Discussion

vaidyarm's avatar
vaidyarm
Contributor
4 years ago

How to Convert Object with Key Values Pairs to Array of key values Pairs

This issue I face a lot of times and there is no simple solution I have found so far, let me know if anyone is able to do it 🙂

Input:

{
   "quotes":{
      "USDAED":3.673325,
      "USDAFN":63.849999,
      "USDALL":124.388,
      "USDAMD":476.287499,
      "USDANG":1.788825,
      "USDAOA":135.371665
   }
}

Output :

{
   "quotes":[
      {"USDAED":3.673325},
      {"USDAFN":63.849999},
      {"USDALL":124.388},
      {"USDAMD":476.287499},
      {"USDANG":1.788825},
      {"USDAOA":135.371665}
   ]
}