title: Parse multiple items in JSON into an array
body: <p>I have a client that retrieves some json from this page. The json content looks like this:</p>
  
  <pre><code>{
    "0": {
      "name": "McDonalds 2",
      "address": "892 West 75th Street, Naperville, IL 60540"
    },
    "1": {
      "name": "McDonalds 1",
      "address": "1298 South Naper Boulevard, Naperville, IL 60540"
    },
    "2": {
      "name": "Burger King 1",
      "address": "2040 Aurora Avenue, Naperville, IL, 60540"
    }
  }
  </code></pre>
  
  <p>I'm having problems parsing it. I always get an exception when trying to parse anything. It's my first time doing json so I might be doing something really bad. This is my code:</p>
  
  <pre><code>public static void parse(String jsonData)
      {
           JSONObject jsonObject = new JSONObject();
           try 
           {
                  jsonObject = new JSONObject(jsonData);
           } 
           catch (JSONException e) 
           {
                  e.printStackTrace();
           }
  
           try 
           {
               // exception happens here when trying to access data
               JSONObject name = ((JSONArray)jsonObject.get("0")).getJSONObject(0)
                          .getJSONObject("name");
  
               JSONObject address = ((JSONArray)jsonObject.get("0")).getJSONObject(0)
                          .getJSONObject("address");
  
           } catch (JSONException e) {}
      }
  </code></pre>
  
  <p>How an I retrieve the name and address of each json item to convert it into a restaurant object?</p>