title: Get sub-array from JSON
body: <p>I parsing some data from a json file. Here is my JSON File.</p>
  
  <pre><code>[
       {
  
         "topic": "Example1", 
         "contact": [
              {
                  "ref": [
                      1
                  ], 
                  "corresponding": true, 
                  "name": "XYZ"
              }, 
              {
                  "ref": [
                      1
                  ], 
                  "name": "ZXY"
              }, 
              {
                  "ref": [
                      1
                  ], 
                  "name": "ABC"
              }, 
              {
                  "ref": [
                      1, 
                      2
                  ], 
                  "name":"BCA"
              }
          ] , 
  
          "type": "Presentation"
       }, 
      {
  
         "topic": "Example2", 
         "contact": [
              {
                  "ref": [
                      1
                  ], 
                  "corresponding": true, 
                  "name": "XYZ"
              }, 
              {
                  "ref": [
                      1
                  ], 
                  "name": "ZXY"
              }, 
              {
                  "ref": [
                      1
                  ], 
                  "name": "ABC"
              }, 
              {
                  "ref": [
                      1, 
                      2
                  ], 
                  "name":"BCA"
              }
          ] , 
  
          "type": "Poster"
       }
  ]
  </code></pre>
  
  <p>I can fetch and store data one by one. Like this one</p>
  
  <pre><code>JSONArray getContactsArray = new JSONArray(jsonObject.getString("contact"));
  for(int a =0 ; a &lt; getContactsArray.length(); a++)
  {
      JSONObject getJSonObj = (JSONObject)getContactsArray.get(a);
      String Name = getJSonObj.getString("name");
  } 
  </code></pre>
  
  <p>1)Now, my question is there any way to get all <code>name</code> values for each array with single query.
  2) Can I get all those values in an <code>Array</code> ?</p>
  
  <p>Please correct me, if I am doing anything wrong. Thank you.</p>