title: How to get the JSON of a response from a service
body: <p>Hey guys im trying to get a response from this service (<a href="http://ip-api.com" rel="nofollow noreferrer">http://ip-api.com</a>) that gives you latitude and longitude based on an ip:</p>
  
  <p>So when you pass the ip 55.130.54.69 it returns the following json:</p>
  
  <pre><code>{
      "query": "55.130.54.69",
      "status": "success",
      "continent": "North America",
      "continentCode": "NA",
      "country": "United States",
      "countryCode": "US",
      "region": "AZ",
      "regionName": "Arizona",
      "city": "Sierra Vista",
      "district": "Fort Huachuca",
      "zip": "85613",
      "lat": 31.5552,
      "lon": -110.35,
      "timezone": "America/Phoenix",
      "currency": "USD",
      "isp": "CONUS-RCAS",
      "org": "USAISC",
      "as": "AS721 DoD Network Information Center",
      "asname": "DNIC-ASBLK-00721-00726",
      "mobile": false,
      "proxy": false
  }
  </code></pre>
  
  <p><a href="http://ip-api.com/#55.130.54.69" rel="nofollow noreferrer">http://ip-api.com/#55.130.54.69</a></p>
  
  <p>So in my service im doing the following (I guided with this <a href="https://stackoverflow.com/questions/1415851/best-way-to-get-geo-location-in-java">Best way to get geo-location in Java</a>):</p>
  
  <pre><code>    @POST
      @Path("/test2")
      public void test2(@Context HttpServletRequest request) {
  
          String ip = request.getRemoteAddr();
          System.out.println("ip: " + ip);
          //Im changing value of ip cause I have an issue with "private range" ip of my machine
          ip = "55.130.54.69";
          // This is working
          Client client = ClientBuilder.newClient();
          Response response = client.target("http://ip-api.com/json/" + ip).request(MediaType.TEXT_PLAIN_TYPE)
                  .header("Accept", "application/json").get();
  
          System.out.println("status: " + response.getStatus()); // Printing 200 so it worked
          System.out.println("body:" + response.getEntity());
          System.out.println("metadata: " + response.getMetadata());
          System.out.println(response);
      }
  </code></pre>
  
  <p>So as you can see im trying to get that json above in my question but I don't know how, can you show me the way please?</p>