From 2b513b131f436e29d00050a6612eb2522ffb9b2b Mon Sep 17 00:00:00 2001 From: John Walicki Date: Fri, 30 Apr 2021 14:00:15 -0400 Subject: [PATCH] remove redundant d:{} Signed-off-by: John Walicki --- WatsonIoT/src/main.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/WatsonIoT/src/main.cpp b/WatsonIoT/src/main.cpp index 9597807..dadd8df 100644 --- a/WatsonIoT/src/main.cpp +++ b/WatsonIoT/src/main.cpp @@ -550,13 +550,12 @@ void Send10Seconds2Cloud() { // Allocate a ArduinoJson buffer large enough to 10 seconds of Accelerometer trace data DynamicJsonDocument historydoc(16384); JsonObject payload = historydoc.to(); - JsonObject status = payload.createNestedObject("d"); - JsonArray alltraces = status.createNestedArray("traces"); + JsonArray alltraces = payload.createNestedArray("traces"); JsonObject acceleration = alltraces.createNestedObject(); // Load the key/value pairs into the serialized ArduinoJSON format - status["device_id"] = deviceID ; - status["device_t"] = time(nullptr); + payload["device_id"] = deviceID ; + payload["device_t"] = time(nullptr); // Generate an array of json objects that contain x,y,z arrays of 32 floats. // [{"x":[],"y":[],"z":[]},{"x":[],"y":[],"z":[]}] @@ -600,13 +599,12 @@ void SendLiveData2Cloud() { // DynamicJsonDocument is stored on the heap DynamicJsonDocument jsonDoc(3000); JsonObject payload = jsonDoc.to(); - JsonObject status = payload.createNestedObject("d"); - JsonArray traces = status.createNestedArray("traces"); + JsonArray traces = payload.createNestedArray("traces"); JsonObject acceleration = traces.createNestedObject(); // Load the key/value pairs into the serialized ArduinoJSON format - status["device_id"] = deviceID; - status["device_t"] = time(nullptr); + payload["device_id"] = deviceID; + payload["device_t"] = time(nullptr); // Generate an array of json objects that contain x,y,z arrays of 32 floats. // [{"x":[],"y":[],"z":[]},{"x":[],"y":[],"z":[]}]