Sending a two-dimensional array to the server and getting through Javascript

I need to send a two dimensional array to server using c arduino language . earlier i used to send through one dimensional array like this.

typedef struct {
  String Name;
  String addr;
  String ttl;
}officeKownNetworks;
officeKownNetworks officeDevice;



JSONVar readings;
String KnownMacDetails() {
        while(true) {
            readings["addrDeviceUser"] = officeDevice.Name;
            readings["addr"] = officeDevice.addr;
            String jsonString = JSON.stringify(readings);
            return jsonString;
        }
        
};

and through spiffs i used to send that data to javascript

server.on("/clientsniffer", HTTP_GET, [](AsyncWebServerRequest *request){
    String json = KnownMacDetails();
    request->send(200, "application/json", json);
    json = String();
  });

and through promises or XML, I used to get data. but in the case of a 2-dimensional array, I am not getting how to send the data.

So basically, I have a loop where the Mac address is going to be saved in this array. of maclist [64] [3];

So how can I send that data to an array on the server, and how can I receive it through javascript? What parameter do I need to use?

Thank You

I am able to send a one-dimensional array to a server through JSON, but I need to know how to send a two-dimensional array to the server and receive it through Javascript.

You asked a similar question already there

And got an initial answer. Please keep the discussion in one place.


Json supports arrays. You could use a library, see JsonDocument::createNestedArray() | ArduinoJson 6

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.