title: how to get a specific element in json object using bufferReader in java
body: <p>I have JSON`` data I'm getting with java <code>GET</code> request.</p>
  
  <p>I need to count how many <code>age</code> objects are greater than 50 in the JSON object.</p>
  
  <p>Right now I am just getting the whole JSON data line by line using <code>bufferreader</code>, but how do I get the single element <code>age</code> in the JSON object and compare it with the number 50? </p>
  
  <pre class="lang-java prettyprint-override"><code>package problem;
  
      import java.io.BufferedReader;
      import java.io.IOException;
      import java.io.InputStream;
      import java.io.InputStreamReader;
      import java.io.OutputStreamWriter;
      import java.net.URL;
      import java.net.URLConnection;
      public class Test {
  
      public static void main(String args[])
      {
       BufferedReader rd;
       OutputStreamWriter wr;
  
      try
      {
          URL url = new URL("https://coderbyte.com/api/challenges/json/age-counting");
          URLConnection conn = url.openConnection();
          conn.setDoOutput(true);
          wr = new OutputStreamWriter(conn.getOutputStream());
          wr.flush();
  
          // Get the response
          rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
          String line;
          while ((line = rd.readLine()) != null) {
             System.out.println(line);
          }
      }
      catch (Exception e) {
              System.out.println(e.toString());
          }
  
        }
  </code></pre>
  
  <p>Sample response for JSON data, I need to get the <code>age</code> value as an <code>integer</code>:</p>
  
  <pre><code>{
     "data":
       "key=IAfpK,
        age=58,
        key=WNVdi,
        age=64,
        key=jp9zt,
        age=47"
  }
  </code></pre>