title: Save response of GET request as class object
body: <p>I am trying to fetch some date using a <code>GET</code> request towards an API. What I want to do is to save the response of this request as a Java class I have created beforehand. Here´s my class:</p>
  <pre class="lang-java prettyprint-override"><code>import java.util.List;
      
  public class Person {
      String name = null;
      List&lt;Siblings&gt; siblings  = null;
  }
  </code></pre>
  <p>And here´s how I am sending a GET request and reading data as String:</p>
  <pre class="lang-java prettyprint-override"><code>try {
      URL url = new URL(&quot;someURL&quot;);
      
      HttpURLConnection connection = (HttpURLConnection) url.openConnection();
      connection.setRequestMethod(&quot;GET&quot;);
      connection.setDoOutput(true);
      connection.setRequestProperty(&quot;Authorization&quot;, &quot;Bearer &quot; + &quot;bearerString&quot;);
      connection.setRequestProperty(&quot;Content-Type&quot;, &quot;application/x-www-form-urlencoded&quot;);
  
      InputStream content = (InputStream) connection.getInputStream();
      BufferedReader in = new BufferedReader(new InputStreamReader(content));
      String line;
      while ((line = in.readLine()) != null) {
          System.out.println(line);
      }
  } catch (Exception e) {
      e.printStackTrace();
  }
  </code></pre>
  <p>How can I save the response of the Http Request in a class object instead of just a String?</p>