improve json output structure
This commit is contained in:
parent
1a1df7a2b9
commit
7a4bc046ab
14
things.ino
14
things.ino
@ -385,12 +385,14 @@ void setup() {
|
|||||||
read_sensor();
|
read_sensor();
|
||||||
DynamicJsonBuffer jsonBuffer;
|
DynamicJsonBuffer jsonBuffer;
|
||||||
JsonObject& json = jsonBuffer.createObject();
|
JsonObject& json = jsonBuffer.createObject();
|
||||||
json["mqtt_server"] = mqtt_server;
|
JsonObject& mqtt = json.createNestedObject("mqtt");
|
||||||
json["mqtt_port"] = mqtt_port;
|
mqtt["server"] = mqtt_server;
|
||||||
json["mqtt_topic"] = mqtt_topic;
|
mqtt["port"] = mqtt_port;
|
||||||
json["temperature"] = str_temperature;
|
mqtt["topic"] = mqtt_topic;
|
||||||
json["humidity"] = str_humidity;
|
JsonObject& dht = json.createNestedObject("dht");
|
||||||
json["heatindex"] = str_heatindex;
|
dht["temperature"] = str_temperature;
|
||||||
|
dht["humidity"] = str_humidity;
|
||||||
|
dht["heatindex"] = str_heatindex;
|
||||||
String response;
|
String response;
|
||||||
json.printTo(response);
|
json.printTo(response);
|
||||||
http_server.send(200, "text/plain", response);
|
http_server.send(200, "text/plain", response);
|
||||||
|
Loading…
Reference in New Issue
Block a user