title: Parsing a JSON from HTTP Response in Java
body: <p>Hi I am using Client Http (apache), and json-simple.</p>
  
  <p>I want to access the attributes of the json response, and then use them.</p>
  
  <p>Any idea how to do this? I read a post and did not work as it but me.</p>
  
  <p>This is my answer json:</p>
  
  <pre><code>{"Name":"myname","Lastname":"mylastname","Age":19}
  </code></pre>
  
  <p>This is my code java:</p>
  
  <pre><code>DefaultHttpClient httpClient = new DefaultHttpClient();
  
  HttpGet getRequest = new HttpGet(
      "http://localhost:8000/responsejava");
  getRequest.addHeader("accept", "application/json");
  
  HttpResponse response = httpClient.execute(getRequest);
  
  if (response.getStatusLine().getStatusCode() != 200) {
      throw new RuntimeException("Failed : HTTP error code : "
               + response.getStatusLine().getStatusCode());
  }
  
  BufferedReader br = new BufferedReader(
      new InputStreamReader( 
          (response.getEntity().getContent())
      )
  );
  
  StringBuilder content = new StringBuilder();
  String line;
  while (null != (line = br.readLine())) {
      content.append(line);
  }
  
  Object obj=JSONValue.parse(content.toString());
  JSONObject finalResult=(JSONObject)obj;
  System.out.println(finalResult);
  
  httpClient.getConnectionManager().shutdown();
  </code></pre>
  
  <p>I printed null, What am I doing wrong?</p>