#include <ArduinoJson.h>
void setup() {
Serial.begin(115200);
uint8_t ty[] = { 152, 205, 172, 35, 236, 147 };
uint8_t mac[] = {0x98, 0xCD, 0xAC, 0x23, 0xEC, 0x93};
// String df = "[[7," + String(id) + ",\"hi_i_am_u_controller\"],[152,205,172,35,236,147]]";
String df = "[[2],[[1,\"div 1\",1,[152,205,172,35,236,147],[\"output\",\"relay\",\"98CDAC23EC93\"]],[2,\"div 2\",1,[152,205,172,35,236,147],[\"output\",\"relay\",\"98CDAC23EC93\"]]]]";
String df2 = "[\"relay\",999,222]";
String ooph = "";
JsonDocument doc;
deserializeJson(doc, df);
//doc.clear();
//doc.add(7);
//doc.add(1);
doc[1][2-1][1] = "tesssssssssss" ;
doc[1][2-1][2] = 4 ;
//doc.add("hi_i_am_u_controller");
//doc.add("oiuyyy");
// JsonDocument doc2;
// deserializeJson(doc2, df2);
//doc[2].clear();
// doc[2].add(doc2);
//uint8_t mac[6];
//copyArray(doc2, doc[0]);
// doc.add(doc2);
//Serial.println(doc[1].is<JsonArray>());
// JsonArray ports = doc[1].createNestedArray();
// int size = doc[0][0].as<int>();
//copyArray(mac, ports);
// int n = size + 1;
// JsonArray newd = doc.createNestedArray();
// copyArray(ty, newd);
// Serial.println(doc[0][0].as<int>());
serializeJson(doc, ooph);
Serial.println(ooph);
// saveroom("wc") ;
}
void loop() {
delay(10);
// not used in this example dela
}