title: JSONArray cannot be converted to JSONObject error
body: <p>While fetching json data I am getting error:</p>
  
  <blockquote>
    <p>JSONArray cannot be converted to JSONObject </p>
  </blockquote>
  
  <p>Code for json generate:</p>
  
  <pre><code>JSONObject parent = new JSONObject();
  DatabaseHandler dbh = new DatabaseHandler(getApplicationContext());  
              for(int i=0; i &lt; allEds.size(); i++){
                  String edsText = allEds.get(i).getText().toString();                                           
                 //spinner = allSpns.get(i);
                 String spinSelected=allSpns.get(i).getSelectedItem().toString();                  
                 try
                  {
                     JSONObject json = new JSONObject();          
                     json.put("Id", i);
                     json.put("FieldName", edsText);
                     json.put("FieldType",spinSelected);
                     parent.accumulate("data", json);
  
  
  
                  }
                  catch (JSONException e)
                  {
                          // TODO Auto-generated catch block
                          e.printStackTrace();
                  }                   
  
              }
  Generated json is   
              {"data":
  [{"FieldType":"Account Number","FieldName":"r","Id":0},
    {"FieldType":"Net      Banking Id","FieldName":"tt","Id":1}
   ]}
  code for json read
  ------------------
  JSONObject jsonObj = new JSONObject(folderStructure);
          JSONObject data = jsonObj.getJSONObject("data"); 
          String id = data.getString("Id"); 
          String value = data.getString("FieldName"); 
          Log.d("Item name: ", value);    
  </code></pre>
  
  <p>While reading the above json am getting errors
  Any thing wrong with the code??</p>