I know the answer for parsing the JSON of this type:
{ "id": "1001", "type": "Regular" },
{ "id": "1002", "type": "Chocolate" },
{ "id": "1003", "type": "Blueberry" },
{ "id": "1004", "type": "Devil's Food"}
where there is key value pair, with key being same(like 'id' here) and value differing, and we use a for loop to parse it quickly.
(For those who'd like to see how to parse above JSON, please go to this link: How to parse nested JSON object using the json library?)
However, the JSON I'm trying to parse is a different one which doesn't have a same key like 'Id' as above for every different value, but every key is a new key with a different value. Below is the example:
{
"disclaimer": "Exchange rates are ...........blah blah",
"license": "Data sourced from various .......blah blah",
"timestamp": 1446886811,
"base": "USD",
"rates": {
"AED": 3.67266,
"AFN": 65.059999,
"ALL": 127.896
.
.
All the currency values.
.
}
}
I'm not sure how to parse the above one with all different keys of currencies (currency like AED and their value) and pop them up in a drop down list.
Do I have to write a new line of code for each different currency and value pair or it is in some way possible to use a for loop for this one as well.
Can someone provide some lines code if possible?