title: Do I need to create new class for every object that retrieve from API in Spring boot
body: <p>Do I need to create new class for JSON object that I retrieve from an API. For example now I am using google ReCAPTCHA API and JSON that it returns looks like this:</p>
  <pre><code>{
    &quot;success&quot;: false,
    &quot;error-codes&quot;: [
      &quot;missing-input-secret&quot;
    ]
  }
  </code></pre>
  <p>I know that when you create POST endpoint and you need to get object from request's body you should create dedicated class which is practical because you created endpoint to get this data in the first place but when I call externall API I don't want to create aditional class for each API that I call(since what I need from it is just boolean), is there any way to just get <code>success</code> property or do I need to create new class. <br />
  My current implementation:</p>
  <pre><code>final String url = &quot;https://www.google.com/recaptcha/api/siteverify?secret={secret}&amp;response={site}&quot;;
  
  Map&lt;String, Object&gt; urlvariables = new HashMap&lt;&gt;();
  
  urlvariables.put(&quot;secret&quot;, env.getProperty(&quot;captcha.secret.key&quot;));
  urlvariables.put(&quot;site&quot;, registerInfo.getCaptcha());
  
  RestTemplate restTemplate = new RestTemplate();
  String consumeJSONString = restTemplate.getForObject(url, uselessclass, urlvariables);
  </code></pre>