Parse JSON object one item at a time
<p>I am playing around for the first time with android development. I am trying to make a simple currency converter app. The particular piece I am working on is populating a spinner box with all of the available currencies without having to code it all in manually. I have a json file that looks like:<br>
<code>{<br>
    "AED": "United Arab Emirates Dirham",<br>
    "AFN": "Afghan Afghani",<br>
    "ALL": "Albanian Lek",<br>
    "AMD": "Armenian Dram",<br>
    "ANG": "Netherlands Antillean Guilder",<br>
    "AOA": "Angolan Kwanza",<br>
    "ARS": "Argentine Peso",<br>
    "AUD": "Australian Dollar",<br>
    "AWG": "Aruban Florin",<br>
        ...<br>
}</code>  </p>

<p>I want to read that object one currency at a time so I can use it to populate the spinner. Something along the lines of:</p>

<pre><code>/*PSEUDOCODE*/
spinner = (Spinner) findViewById(R.id.currencyTo);
List&lt;String&gt; list = new ArrayList&lt;String&gt;();
JSONParser jParser = new JSONParser();
JSONObject json = jParser.getJSONFromUrl(url);
while (rates != null) {
rates = json.getString(first item in json);
list.add(rates);
...
</code></pre>

<p>I know how to do it by calling each item individually, such as rates = json.getString("AED") and so on, but I don't want it so hardcoded like that. I want to parse each currency item individually, then place it in the spinner. Grab the next currency, place it in the spinner, and so on and so forth. Any help is greatly appreciated. </p>
