Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By helpme
#21488 I would like to use Arduino IDE to use a standalone ESP8266 to send a HTTP GET. The webpage will return json and ESP8266 needs to parse the json to extract certain values.

How can this be done using Arduino IDE? Any sample code as a start?
User avatar
By Stephen
#21566 Here's a small snippet, the JSON "detection" is pretty simplistic in this case.
Code: Select all  client.println("POST /index.php HTTP/1.1");
  client.println("Host:  post.mofuckr.com");
  client.println("User-Agent: Arduino/1.0");
  client.println("Connection: close");
  client.println("Content-Type: application/x-www-form-urlencoded;");
  client.print("Content-Length: ");
  client.println(PostData.length());
  client.println();
  client.println(PostData);
  while(client.available())
  {
    String line = client.readStringUntil('\r');
    if (line.indexOf("state\":\"TRUE")) {
      Serial.println("Submission Sucessful");
      return true;
    } else {
      Serial.println("Submission Error:");
      Serial.println("Error On Server!");
      Serial.print(line);
      return false;
    }
  }
}