I have two dimensional array from sensor reading, id and time_update.
for an example i write loop to adding value to array like this :
String biDimArray[5][2];
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
Serial.println();
int a, b;
for (a = 0; a < 5; a++) { //edited
biDimArray[a][0] = String(analogRead(A0));
biDimArray[a][1] = "2023-07-03 15:17:01";
delay(15);
}
Serial.println();
Serial.println("My Two Dimensional Array:");
for (a = 0; a < 35; a++) {
for (b = 0; b < 2; b++) {
Serial.print(biDimArray[a][b]);
Serial.print(' ');
}
Serial.println();
}
Serial.println();
}
void loop() {
// put your main code here, to run repeatedly:
}
{
{"13", "2023-07-03 15:17:01"},
{"77", "2023-07-03 15:17:01"},
{"8", "2023-07-03 15:17:01"},
{"113", "2023-07-03 15:17:01"},
{"17", "2023-07-03 15:17:01"}
}
now i want encode this array to JSON. I already using Assistant | ArduinoJson 6 but i need to create dynamic function like
void sendJson(array){
somevar = encodeJson(array);
httpCode = httpPost(somevar);
}