I'm able to print parsed values to Serial using this example. The relevant section of the code is at the bottom of the post. Are there ways to store the data as other types of variables so I can do other things like post to ThingSpeak? I was able to store the data in a form that would post to ThingSpeak by adding these long variables. This cuts everything off after the decimal, though, and I'd like to avoid that. Are there solutions while still keeping this library? I see a lot of examples using ArduinoJson.h instead. Do I need to learn how to use that one to do what I want?
long outsideTemp = myObject[String("main")][String("temp")];
long outsideHumidity = myObject[String("main")][String("humidity")];
String serverPath = "http://api.openweathermap.org/data/2.5/weather?q=" + city + "," + state + "," + countryCode + "&units=imperial" + "&APPID=" + ApiKey;
Serial.println(serverPath);
jsonBuffer = httpGETRequest(serverPath.c_str());
Serial.println(jsonBuffer);
JSONVar myObject = JSON.parse(jsonBuffer);
if (JSON.typeof(myObject) == "undefined") {
Serial.println("Parsing input failed!");
return;
}
Serial.print("JSON object = ");
Serial.println(myObject);
Serial.print("Temperature: ");
Serial.println(myObject["main"]["temp"]);
Serial.print("Pressure: ");
Serial.println(myObject["main"]["pressure"]);
Serial.print("Humidity: ");
Serial.println(myObject["main"]["humidity"]);
Serial.print("Wind Speed: ");
Serial.println(myObject["wind"]["speed"]);