Updated the examples on wandbox.org

This commit is contained in:
Benoit Blanchon
2019-02-26 10:02:52 +01:00
parent 21998890d4
commit 3530aa88d6
3 changed files with 39 additions and 39 deletions

View File

@ -49,17 +49,14 @@ int main() {
return 1;
}
// Get the root object in the document
JsonObject root = doc.as<JsonObject>();
// Fetch values.
//
// Most of the time, you can rely on the implicit casts.
// In other case, you can do doc["time"].as<long>();
const char* sensor = root["sensor"];
long time = root["time"];
double latitude = root["data"][0];
double longitude = root["data"][1];
const char* sensor = doc["sensor"];
long time = doc["time"];
double latitude = doc["data"][0];
double longitude = doc["data"][1];
// Print values.
std::cout << sensor << std::endl;