title: Java HttpRequest JSON & Response Handling
body: <p>I have looked at several other questions, but I still don't fully understand this.
  I want to POST a JSON string to a remote address and then retrieve the values from the JSON response.
  I am using the Apache libraries for Java.</p>
  
  <pre><code>public HttpResponse http(String url, String body) throws IOException {
  
      try (CloseableHttpClient httpClient = HttpClientBuilder.create().build()) {
          HttpPost request = new HttpPost(url);
          StringEntity params = new StringEntity(body);
          request.addHeader("content-type", "application/json");
          request.setEntity(params);
          //httpClient.execute(request);
          HttpResponse result = httpClient.execute(request);
  
      } catch (IOException ex) {
      }
      return null;
  }
  </code></pre>
  
  <p>And as body, I would pass the following (an example):</p>
  
  <pre><code>{"example":1,"fr":"lol"}
  </code></pre>
  
  <p>I have absolutely no idea about how to retrieve the JSON values from the response, either.</p>