I want to send arbitrarily complex array data to a Java servlet, but have no idea how to read it on the servlet side. Here is the client side:
var data = {
name : 'Jack',
age : 30,
info : [ [1,2] , [3,4] , [5,6] ],
info2: [1,2,3]
}
$.ajax({
url: someURL,
data: data,
success: function(resp) { console.log(resp); }
});
I know I can use JSON.stringify and then parse it out on the server side, but for the sake of this question, I can't change the front end code. How do I read the "info" variable on the server side using the HttpServletRequest object? I also know you can do something like this for single arrays:
String[] info2 = request.getParameterValues("info2[]");
But this doesn't work with 2D arrays or more complicated arrays.
Any ideas?