title: How do I extract the "extract" attribute from JSON?
body: <p>I am trying read JSON data from this <a href="https://en.wikipedia.org/w/api.php?format=json&amp;action=query&amp;prop=extracts&amp;exintro=&amp;explaintext=&amp;titles=Russell%27s_paradox" rel="nofollow noreferrer">link</a>.</p>
  <p>I am able to read the entire data inside pages attribute using :</p>
  <pre><code>JSONObject data=(JSONObject)new JSONTokener(IOUtils.toString(new URL(&quot;https://en.wikipedia.org/w/api.php?format=json&amp;action=query&amp;prop=extracts&amp;exintro=&amp;explaintext=&amp;titles=Russell%27s_paradox&quot;))).nextValue();
  String pageName=data.getJSONObject(&quot;query&quot;).getString(&quot;pages&quot;);
  System.out.println(pageName);
  </code></pre>
  <p>I want to get the data from &quot;extract&quot; attribute next from the above mentioned link, which I am unable to. I am new with this and I can't find any resources to learn this.</p>
  <p>I tried the following code but I am getting a JSONException.</p>
  <pre><code>JSONArray arr=data.getJSONArray(&quot;pages&quot;);
  for(int i=0;i&lt;arr.length();i++){
  String def=arr.getJSONObject(i).getString(&quot;extract&quot;);
  System.out.println(def);
  }
  </code></pre>
  <p>Help.</p>