From 3120783000d0025b183b0397acaa8b769499eb38 Mon Sep 17 00:00:00 2001 From: krolyxon Date: Mon, 8 Jun 2026 23:10:46 +0530 Subject: Initial gh-pages firmware hosting --- .../JsonParserExample/JsonParserExample.ino | 65 ++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 .pio/libdeps/esp32-s3-n16r8/ArduinoJson/examples/JsonParserExample/JsonParserExample.ino (limited to '.pio/libdeps/esp32-s3-n16r8/ArduinoJson/examples/JsonParserExample') diff --git a/.pio/libdeps/esp32-s3-n16r8/ArduinoJson/examples/JsonParserExample/JsonParserExample.ino b/.pio/libdeps/esp32-s3-n16r8/ArduinoJson/examples/JsonParserExample/JsonParserExample.ino new file mode 100644 index 0000000..b7aa6b7 --- /dev/null +++ b/.pio/libdeps/esp32-s3-n16r8/ArduinoJson/examples/JsonParserExample/JsonParserExample.ino @@ -0,0 +1,65 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2026, Benoit BLANCHON +// MIT License +// +// This example shows how to deserialize a JSON document with ArduinoJson. +// +// https://arduinojson.org/v7/example/parser/ + +#include + +void setup() { + // Initialize serial port + Serial.begin(9600); + while (!Serial) + continue; + + // Allocate the JSON document + JsonDocument doc; + + // JSON input string. + const char* json = + "{\"sensor\":\"gps\",\"time\":1351824120,\"data\":[48.756080,2.302038]}"; + + // Deserialize the JSON document + DeserializationError error = deserializeJson(doc, json); + + // Test if parsing succeeds + if (error) { + Serial.print(F("deserializeJson() failed: ")); + Serial.println(error.f_str()); + return; + } + + // Fetch the values + // + // Most of the time, you can rely on the implicit casts. + // In other case, you can do doc["time"].as(); + const char* sensor = doc["sensor"]; + long time = doc["time"]; + double latitude = doc["data"][0]; + double longitude = doc["data"][1]; + + // Print the values + Serial.println(sensor); + Serial.println(time); + Serial.println(latitude, 6); + Serial.println(longitude, 6); +} + +void loop() { + // not used in this example +} + +// See also +// -------- +// +// https://arduinojson.org/ contains the documentation for all the functions +// used above. It also includes an FAQ that will help you solve any +// deserialization problem. +// +// The book "Mastering ArduinoJson" contains a tutorial on deserialization. +// It begins with a simple example, like the one above, and then adds more +// features like deserializing directly from a file or an HTTP request. +// Learn more at https://arduinojson.org/book/ +// Use the coupon code TWENTY for a 20% discount ❤❤❤❤❤ -- cgit v1.2.3