title: How to parse json with multiple objects in a array?
body: <p>I have <code>JSONArray</code> having following structure:</p>
  
  <pre><code>{
  
      "People":[
          {
              "006MST21IND":{
                  "desc":"MST21 BAL. PR. THERMOSTATIC STEAM TRAP",
                  "attribute":"1,b_“F”ELEMENT / c_`G' ELEMENT;2,b_“F”ELEMENT / c_`G' ELEMENT;3, b_“F”ELEMENT / c_`G' ELEMENT"
              }
          },
          {
              "006MST22IND":{
                  "desc":"MST21 BAL. PR. THERMOSTATIC STEAM TRAP",
                  "attribute":"1,b_“F”ELEMENT / c_`G' ELEMENT;2,b_“F”ELEMENT / c_`G' ELEMENT;3, b_“F”ELEMENT / c_`G' ELEMENT"
              }
          }
      ]
  
  }
  </code></pre>
  
  <p>I am trying, but it is giving following exception,</p>
  
  <pre><code>org.json.JSONException: Value [{"006MST21IND":{"attribute":"1,b_�F�ELEMENT \/ c_`G' ELEMENT;2,b_�F�ELEMENT \/ c_`G' ELEMENT;3, b_�F�ELEMENT \/ c_`G' ELEMENT","desc":"MST21 BAL. PR. THERMOSTATIC STEAM TRAP"}},{"006MST22IND":{"attribute":"1,b_�F�ELEMENT \/ c_`G' ELEMENT;2,b_�F�ELEMENT \/ c_`G' ELEMENT;3, b_�F�ELEMENT \/ c_`G' ELEMENT","desc":"MST21 BAL. PR. THERMOSTATIC STEAM TRAP"}}] 
  at People of type org.json.JSONArray cannot be converted to JSONObject
  </code></pre>
  
  <p>code is :</p>
  
  <p>I am saving json data in file and taking from it as,</p>
  
  <pre><code>File root = Environment.getExternalStorageDirectory();
  File jsonFile = new File(root, "jsonFile.txt");
  FileInputStream stream;
  String jsonStr = null;
  stream = new FileInputStream(jsonFile);
  
  
  
  FileChannel fc = stream.getChannel();
  MappedByteBuffer bb = fc.map(FileChannel.MapMode.READ_ONLY, 0, fc.size());
  
  jsonStr = Charset.defaultCharset().decode(bb).toString();
  
  
  stream.close();
  </code></pre>
  
  <p>then by using that jsonStr, i am using following logic...</p>
  
  <pre><code>JSONObject jsonObj = new JSONObject(jsonStr);
  
  JSONObject jsonObj1 = jsonObj.getJSONObject("People");
  JSONArray myJson=jsonObj1.getJSONArray("006MST21IND");
  
  if (myJson!=null &amp;&amp; myJson.length()!=0) {
  
  
      for(int i=0;i&lt;myJson.length();i++)
      {
          JSONObject obj2 = myJson.getJSONObject(i);
  
          desc = obj2.getString("desc");
          attribute = obj2.getString("attribute");
  
          Log.e("Desc:", desc);
          Log.e("Attribute:", attribute);
      }
  
  }
  </code></pre>
  
  <p>I was trying but failed.</p>