title: arduino ide esp8266 json decode from URL
body: <p>I program esp8266 using the Arduino IDE. I join with the local network via WIFI. Ultimately, I want to download content JSON generated on the local server. I am using the code:</p>
  
  <pre><code> #include &lt;ESP8266WiFi.h&gt;
      #include &lt;ArduinoJson.h&gt;
  
      const char* ssid     = "NeoRaf";
      const char* password = "password";
      const char* host = "192.168.1.8";
  
      void setup() {
        Serial.begin(115200);
        delay(100);
  
        // We start by connecting to a WiFi network
  
        Serial.println();
        Serial.println();
        Serial.print("Connecting to ");
        Serial.println(ssid);
  
        WiFi.begin(ssid, password);
  
        while (WiFi.status() != WL_CONNECTED) {
          delay(500);
          Serial.print(".");
        }
  
        Serial.println("");
        Serial.println("WiFi connected");  
        Serial.println("IP address: ");
        Serial.println(WiFi.localIP());
  
        //-----------------------
        delay(5000);
  
        Serial.print("connecting to ");
        Serial.println(host);
  
        // Use WiFiClient class to create TCP connections
        WiFiClient client;
        const int httpPort = 8095;
        if (!client.connect(host, httpPort)) {
          Serial.println("connection failed");
          return;
        }
  
        // We now create a URI for the request
        String url = "/api";
        Serial.print("Requesting URL: ");
        Serial.println(url);
  
        // This will send the request to the server
        client.print("GET " + url + " HTTP/1.1\r\n" +
                     "Host: " + host + "\r\n" +
                     "ApiCode: 8273\r\n" +
                     "Content-Type: application/json\r\n" + 
                     "Connection: close\r\n\r\n");
        delay(500);
         char c[1024];
        // Read all the lines of the reply from server and print them to Serial
         while(client.available()){
            c[0] = client.read();
  
        //Serial.print(c);
  
       Serial.print(c);
       }
         StaticJsonBuffer&lt;200&gt; jsonBuffer;
         JsonObject&amp; root = jsonBuffer.parseObject(c);
        int data = root["lowVersion"];  
        Serial.println();
           Serial.print(data);
  
        Serial.println();
        Serial.println("closing connection");  
      }
  
      void loop()
      {}
  </code></pre>
  
  <p>The result is this:</p>
  
  <pre><code>    Connecting to NeoRaf
      ......
      WiFi connected
      IP address: 
      192.168.1.21
      connecting to 192.168.1.8
      Requesting URL: /api
      HTTP/1.1 200 OK
      Content-Length: 32
      Content-Type: application/json
      Server: Microsoft-HTTPAPI/2.0
      Access-Control-Allow-Origin: *
      Date: Mon, 06 Jun 2016 16:50:48 GMT
      Connection: close
  
  {"lowVersion":1,"highVersion":3}
  0
  closing connection
  </code></pre>
  
  <p>This line is JSON:</p>
  
  <pre><code>{"lowVersion":1,"highVersion":3}
  </code></pre>
  
  <p>So it should display 1 and displays 0.
  I do not know how to get rid of the header:</p>
  
  <pre><code>HTTP/1.1 200 OK
  Content-Length: 32
  Content-Type: application/json
  Server: Microsoft-HTTPAPI/2.0
  Access-Control-Allow-Origin: *
  Date: Mon, 06 Jun 2016 16:50:48 GMT
  </code></pre>
  
  <p>and how to read the contents of JSON ( lowVersion or highVersion)?</p>