title: How to get parameters from CloseableHttpResponse
body: <p>I want to get the individual parameters from the server response, for example I want to get the value of &quot;access_token&quot;, so in this case: &quot;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxx-xxxxxxxxxxxxxxxxx&quot;, what can I do?</p>
  <pre><code>    void GetAccessToken(User user, String productID, String token) throws IOException
  {
      CloseableHttpClient httpClient = null;
      HttpPost post = null;
      CloseableHttpResponse response = null;
  
      try
      {
          httpClient = HttpClientBuilder.create().build();
          post = new HttpPost(&quot;https://accounts.google.com/o/oauth2/token&quot;);
          ArrayList&lt;BasicNameValuePair&gt; nvps = new ArrayList&lt;BasicNameValuePair&gt;();
          nvps.add(new BasicNameValuePair(&quot;grant_type&quot;, &quot;refresh_token&quot;));
          nvps.add(new BasicNameValuePair(&quot;client_id&quot;, &quot;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.apps.googleusercontent.com&quot;));
          nvps.add(new BasicNameValuePair(&quot;client_secret&quot;, &quot;xxxxxxxxxxxxxxxxxxxx&quot;));
          nvps.add(new BasicNameValuePair(&quot;redirect_uri&quot;, &quot;https://www.my.app/&quot;));
          nvps.add(new BasicNameValuePair(&quot;refresh_token&quot;, &quot;1/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&quot;));
          post.setEntity(new UrlEncodedFormEntity(nvps, StandardCharsets.UTF_8));
          response = httpClient.execute(post);
          int responseCode = response.getStatusLine().getStatusCode();
          String responseBody = EntityUtils.toString(response.getEntity());
          
          System.out.println(&quot;response: &quot; + response.toString());
          System.out.println(&quot;responseCode: &quot; + responseCode);
          System.out.println(&quot;responseBody: &quot; + responseBody);            
      }
      catch (Exception ex)
      {
          System.out.println(&quot;Error occured due to ::&quot; + ex.getMessage());
      }
      finally
      {
          if (httpClient != null) httpClient.close();
          if (post != null) post.releaseConnection();
          if (response != null) response.close();
  
          Check_InApp_Purchase(user, productID, token);
      }
  }
  </code></pre>
  <p>Server response <strong>complete</strong>:</p>
  <pre><code>GetAccessToken response: HttpResponseProxy{HTTP/1.1 200 OK [Cache-Control: 
  no-cache, no-store, max-age=0, must-revalidate, Pragma: no-cache, Date: Thu, 04 Mar 2021 14:34:45 GMT, Expires: Mon, 01 Jan 1990 00:00:00 GMT, Content-Type: application/json; charset=utf-8, Vary: Origin, Vary: X-Origin, Vary: Referer, Server: scaffolding on HTTPServer2, X-XSS-Protection: 0, X-Frame-Options: SAMEORIGIN, X-Content-Type-Options: nosniff, Alt-Svc: h3-29=&quot;:443&quot;; ma=2592000,h3-T051=&quot;:443&quot;; ma=2592000,h3-Q050=&quot;:443&quot;; ma=2592000,h3-Q046=&quot;:443&quot;; ma=2592000,h3-Q043=&quot;:443&quot;; ma=2592000,quic=&quot;:443&quot;; ma=2592000; v=&quot;46,43&quot;, Transfer-Encoding: chunked] org.apache.http.client.entity.DecompressingEntity@31612345}
  responseCode: 200
  responseBody: {
  &quot;access_token&quot;: &quot;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxx&quot;,
  &quot;expires_in&quot;: 3599,
  &quot;scope&quot;: &quot;https://www.googleapis.com/auth/androidpublisher&quot;,
  &quot;token_type&quot;: &quot;Bearer&quot;
  }
  </code></pre>
  <p>If the code has something wrong, don't hesitate to write it to me!</p>