I would like to ask about how to pass the multiple JSON object from Client to Server side. At first, I got the JSON object from 3rd Party API. After that, I want to pass them to Java method on the Server side. This is what I have tried but it is not success
on Client side (JSP)
function getInfo(InkBlob){
var myInkBlob = JSON.stringify(InkBlob);
jQuery.ajax({
type: 'POST',
url: '/webapp/filepicker/importAssets',
dataType: 'json',
data: {"inkBlob": myInkBlob}
});}
jQuery POST the data as
If I don't use JSON.stringify, the result will be like,
This is the method that Response for the incoming data
@RequestMapping(value = "/importAssets", method = RequestMethod.POST)
@ResponseBody
public void importAssets2(String[] inkBlob) throws Exception {
System.out.println(inkBlob); // print as [Ljava.lang.String;@56bdbbec (and another 2 similar)
System.out.println(inkBlob.length); // print as 15}
I want to use the data inside the object. For example, if I want to get the URL of the first object. I want to just inkBlob[0].URL
. And the expected length of the inkBlob in this example should be 3 because only 3 object pass to the method. How can I achieve that???