Files
project-vesper/JSON_functions.hpp

26 lines
556 B
C++

#pragma once
void reconstr (String payload) {
JsonDocument doc;
DeserializationError error = deserializeJson(doc, payload);
if (error) {
Serial.print("deserializeJson() failed: ");
Serial.println(error.c_str());
return;
}
// EXAMPLE PAYLOAD. CHANGE THIS TO THE APPROPRIATE ONE.
int a = doc["a"];
bool b = doc["b"];
float c = doc["c"];
Serial.println("The payload received contains: ");
Serial.print("a: ");
Serial.print(a);
Serial.print(" b: ");
Serial.print(b);
Serial.print(" c: ");
Serial.println(c);
}