title: org.json.JSONException: No value for comments
body: <p>I have a Json data that i am getting from a wordpress blog and when i tried passing the url I get this error in my logcat saying <strong>org.json.JSONException: No value for comments.</strong> </p>
  
  <p>what am trying to do is retrieve commments from a wordpress blog. </p>
  
  <p>I have pasted my full code <a href="http://pastebin.com/eezNMHjj" rel="nofollow">here</a> for further references, </p>
  
  <pre><code>03-13 11:43:59.698: W/System.err(18926): org.json.JSONException: No value for comments
  03-13 11:43:59.698: W/System.err(18926):    at org.json.JSONObject.get(JSONObject.java:354)
  03-13 11:43:59.698: W/System.err(18926):    at org.json.JSONObject.getJSONArray(JSONObject.java:544)
  03-13 11:43:59.698: W/System.err(18926):    at com.cepfmobileapp.org.CommentActivityWp$GetQuery.doInBackground(CommentActivityWp.java:271)
  03-13 11:43:59.698: W/System.err(18926):    at com.cepfmobileapp.org.CommentActivityWp$GetQuery.doInBackground(CommentActivityWp.java:1)
  03-13 11:43:59.698: W/System.err(18926):    at android.os.AsyncTask$2.call(AsyncTask.java:287)
  03-13 11:43:59.698: W/System.err(18926):    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
  03-13 11:43:59.698: W/System.err(18926):    at java.util.concurrent.FutureTask.run(FutureTask.java:137)
  03-13 11:43:59.708: W/System.err(18926):    at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
  03-13 11:43:59.708: W/System.err(18926):    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
  03-13 11:43:59.708: W/System.err(18926):    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
  03-13 11:43:59.708: W/System.err(18926):    at java.lang.Thread.run(Thread.java:856)
  </code></pre>
  
  <p>Java Code</p>
  
  <pre><code>    private static final String TAG_COMMENTS = "comments";
  private static final String TAG_ID = "id";
  private static final String TAG_NAME = "name";
  private static final String TAG_CONTENT = "content";
  
  
      Intent i = getIntent();
      // Receiving the Data
      ida = i.getStringExtra("id");
      url = "" + ida;
  
  
      @Override
      protected Void doInBackground(Void... arg0) {
          // Creating service handler class instance
          ServiceHandler sh = new ServiceHandler();
  
          // Making a request to url and getting response
          String jsonStr = sh.makeServiceCall(url, ServiceHandler.GET);
  
          Log.d("Response: ", "&gt; " + jsonStr);
  
          if (jsonStr != null) {
              try {
                  JSONObject jsonObj = new JSONObject(jsonStr);
  
                  // Getting JSON Array node
                  comments = jsonObj.getJSONArray(TAG_COMMENTS);
  
                  // looping through All Contacts
                  for (int i = 0; i &lt; comments.length(); i++) {
                      JSONObject c = comments.getJSONObject(i);
  
  
                      // Phone node is JSON Object
                       //JSONObject comments = c.getJSONObject(TAG_COMMENTS );
                       String id = c.getString(TAG_ID);
                       String name = c.getString(TAG_NAME);
                       String content = c.getString(TAG_CONTENT);
  
                      // tmp hashmap for single contact
                      HashMap&lt;String, String&gt; contact = new HashMap&lt;String, String&gt;();
  
                      // adding each child node to HashMap key =&gt; value
                      contact.put(TAG_ID, id);
                      contact.put(TAG_NAME, name);
                      contact.put(TAG_CONTENT, content);
  
  
                      // adding contact to contact list
                      queryList.add(contact);
                  }
              } catch (JSONException e) {
                  e.printStackTrace();
              }
          } else {
              Log.e("ServiceHandler", "Couldn't get any data from the url");
          }
  
          return null;
      }
  </code></pre>