title: HttpResponse to JSON
body: <p>I'm executing the following:</p>
  
  <pre><code>HttpGet getMethod = new HttpGet(url);
  getMethod.addHeader("Accept","application/x-oslc-cm-change-request+json");
  HttpResponse httpResponse = httpClient.execute(getMethod);
  </code></pre>
  
  <p>where the URL is pointing to an XML file, which is:</p>
  
  <pre><code>&lt;oslc_cm:Collection oslc_cm:totalCount="1"&gt;
      &lt;rtc_cm:Project rdf:resource="https://private"/&gt;
  &lt;/oslc_cm:Collection&gt;
  </code></pre>
  
  <p>Next, I execute</p>
  
  <pre><code>InputStream is = httpResponse.getEntity().getContent();
  String json = convertStreamToString(is);
  JSON jsonObject = JSONSerializer.toJSON(json);
  </code></pre>
  
  <p>At the last line, I get an exception, JSONException: Invalid JSON String.</p>
  
  <p>Is there something that I'm not doing, or missing something?</p>
  
  <p>The variable json contains the http response, which is:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  
  &lt;!--
  a comment
  
  --&gt;
  
  &lt;html&gt;
  
  &lt;head&gt;
  &lt;meta http-equiv="content-type" content="text/html; charset=UTF-8"&gt;
  &lt;meta http-equiv="X-UA-Compatible" content="IE=8"&gt;
  &lt;title&gt;&lt;/title&gt;
  
  &lt;link type="text/css" rel="stylesheet" href="/jazz/web/_style/?inclu
  VelSxGN_en_US&amp;_proxyURL=%2Fjazz"&gt;
  &lt;link rel="shortcut icon" href="/jazz/web/net.jazz.ajax/jazz.ico"&gt;
  
  &lt;style type="text/css"&gt;
  #net-jazz-ajax-NoScriptMessage {
      width: 100%;
      color: #D0D0D0;
      font-size: 2em;
      text-align: center;
      position: absolute;
      top: 1%;
      z-index: 999;
  }
      &lt;/style&gt;
  
  &lt;/head&gt;
  
  &lt;body class="tundra"&gt;
      &lt;noscript&gt;&lt;div id="net-jazz-ajax-NoScriptMessage"&gt;Javascript is disabled or not available in your Browser&lt;/div&gt;&lt;/noscript&gt;
  &lt;div id="net-jazz-ajax-InitialLoadMessage"&gt;Loading...&lt;/div&gt;
  &lt;div id="net-jazz-ajax-WorkbenchRoot"&gt;&lt;/div&gt;
  
  &lt;script type="text/javascript"&gt;
          djConfig = {
                  isDebug: false,
                  usePlainJson: true,
                  baseUrl: "/jazz/web/dojo/",
                  locale: "en-us",
                  localizationComplete: true
          };
          /*null*/
          net = {jazz: {ajax: {}}};
          net.jazz.ajax._contextRoot = "/jazz";
          net.jazz.ajax._webuiPrefix = "/web/";
  &lt;/script&gt;
  
  &lt;script type="text/javascript" src="/jazz/web/_js/?include=Z~&amp;eten_US"&gt;&lt;/script&gt;
  
  
  &lt;script type="text/javascript"&gt;
  /* &lt;![CDATA[ */
  
  dojo.getObject('jazz.core.loader', true)._loaded=['Z'];
  net.jazz.ajax._rootServices = 'https://private';
  
  net.jazz.ajax._storageService = 'https://private';
  
  net.jazz.ajax._queryService = 'https://private';
  
  net.jazz.ajax._infoCenterRoot = 'https://private';
  
  net.jazz.ajax._oauthRealmName = 'Jazz';
  
  net.jazz.ajax._viewletServiceRoot = 'https://private';
  
  net.jazz.ajax._viewletWebUIRoot = 'https://private';
  
  net.jazz.ajax._hasLocalRepository = true;
  net.jazz.ajax._proxyLegacyMode = false;
  net.jazz.ajax._oauthDomains = ['https://private']
  
  net.jazz.ajax._friendDomains = ['https://private']
  
  
  /* ]]&gt; */
  &lt;/script&gt;
  
  &lt;script type="text/javascript"&gt;
  /* &lt;![CDATA[ */
          dojo.addOnLoad( function() {
                  net.jazz.ajax.ui.PlatformUI.createAndRunWorkbencweb.app.authrequired");
          });
  /* ]]&gt; */
  &lt;/script&gt;
  &lt;/body&gt;
  &lt;/html
  </code></pre>
  
  <p>Thanks</p>