title: Retrieving all values of json object into array list
body: <p>I have a json object as below</p>
  
  <pre><code>{
  "Book1":{"Title1":"Cost1","Title2":"Cost2"}, 
  "Book2":{"Title3 ":"Cost3"},
  "Book3":{"Title4 ":"Cost4","Title5 ":"Cost5"},
  "Book4":{"Title6":"Cost6","Title7”:”Cost7","Title8”:”Cost8"}
  }
  </code></pre>
  
  <p>I want to retrieve all the values of "Titles" without any keywords i.e I would like to have {Title1,Title2,Title3,Title4,...} in an array.</p>
  
  <p>Below is my code to retrieve based on Book name but now I need to retrieve all the values </p>
  
  <pre><code>    List&lt;String&gt; books=new ArrayList&lt;String &gt;();
      try {
          JSONObject obj = new JSONObject(loadJSONFromAssetArea());
          JSONObject bookJson = obj.getJSONObject("Book1");
  
  
          Iterator&lt;String&gt; keys= bookJson.keys();
          do
          {
              String keyValue = (String)keys.next();
              JSONArray specTitle = obj.getJSONArray(keyValue);
              for (int i = 0; i &lt; specTitle.length(); i++) {
                 books.add(specTitle.get(i).toString());
              }
  
          }while(keys.hasNext());
  
  
      } catch (JSONException e) {
          e.printStackTrace();
      }
  </code></pre>
  
  <p>I am not getting how to get with out passing key values to json object .
  Kindly help.</p>
  
  <p>Thanks in advance</p>