title: how to fetch tags from wordpress posts JSON results in android Java
body: <p>I am trying to make an android app that fetch posts from my wordpress blog that displays the information in a list. I am able to get the results like title, description,etc but i am not able to get nested object "tags" from the JSON result. So, can you explain me how i can get the tag names from the JSON result from this <a href="https://public-api.wordpress.com/rest/v1.1/sites/geekygamersclub.wordpress.com/posts/?number=2&amp;pretty=true" rel="nofollow noreferrer">JSON Response</a>.</p>
  
  <p>I am trying to use the following code :</p>
  
  <pre><code>JSONObject root = new JSONObject(postJSON);
          JSONArray postsArray = root.getJSONArray("posts");
  
  
          for (int i = 0; i &lt; postsArray.length(); i++) {
              // Get a single post at position i within the list of earthquakes
              JSONObject currentPost = postsArray.getJSONObject(i);
  
              String title = currentPost.getString("title");
              Log.e(LOG_TAG, "title is " + title);
  
              JSONObject tags = currentPost.getJSONArray("tags").getJSONObject(0);
              String tag = tags.getString("name");
              Log.e(LOG_TAG, "tag is " + tag);
  
              Post post = new Post(title,"123", tag);
              posts.add(post);
          }
  </code></pre>
  
  <p>But the logcat is showing that the value can't be converted to JSONArray.</p>