我想要来自 Esp8266 的这个输出 Json
我正在尝试使用另一个 json lib https://github.com/arduino-libraries/Arduino_JSON 这是比 arduinojson.org 轻量级的库
{
"ID": "0785E7",
"DEVICE": "SINGLE_RELAY",
"Public_Name": "Demo Switch",
"version": 1,
"payloadVersion": 1,
"SW": 1,
"HW": 1,
"CHIPSIZE": 1048576,
"CHIPSPEED": 40000000,
"CHIPMODE": 3,
"capabilities": [
{
"interface": "Demo.Switch",
"type": "ONOFF",
"version": "1.0",
"sync": true,
"control_pin": 2,
"MQTT_SWITCH_TOPIC": "on",
"MQTT_SWITCH_SYNC": "sync"
},
{
"interface": "Demo.Countdown",
"type": "Countdown",
"version": "1.0",
"sync": true,
"control_pin": 2,
"MQTT_SWITCH_TOPIC": "s",
"MQTT_SWITCH_SYNC": "x"
},
{
"interface": "Demo.Schedule",
"type": "Schedule",
"version": "1.0",
"sync": true,
"control_pin": 2,
"MQTT_SWITCH_TOPIC": "s",
"MQTT_SWITCH_SYNC": "x"
}
]
}
Arduino 功能
String Device_info()
{
JSONVar json;
json["ID"] = ESPID;
json["DEVICE"] = DEVICE_TYPE;
json["Public_Name"] = DEVICE_CHANNEL;
json["version"] = relaystatus1;
json["payloadVersion"] = RelayPIN;
json["SW"] = userid;
json["HW"] = Trigger;
json["CHIPSIZE"] = rssi_str;
json["CHIPSPEED"] = "1";;
String jsonString = JSON.stringify(json);
}
我想在这个 Like Above json 中添加“功能”objectArray。