Can not deserialize instance of CUSTOM_CLASS out of START_ARRAY token
I am trying to send an objects array to Spring con开发者_开发知识库troller via jQuery AJAX. Here is the javascript code:
var data = new Array();
$.each(products, function (i) {
var temp = {};
temp.orpid = products[i].orpid;
temp.orpah = $('#orpah' + products[i].orpid).is(':checked');
temp.orpad = $('#orpad' + products[i].orpid).val();
data.push(temp);
});
$.postJSON(url + 'save',
data,
function(response) {
if (response.isAuthenticated && response.isAuthorized) {
if (response.hasErrors) {
$('#routeForm').setErrors(response.errors);
hideWait();
}
}
else
redirectToLogin();
});
The params that are sended to server:
[{"orpid":10,"orpah":false,"orpad":""},{"orpid":11,"orpah":false,"orpad":""}]
The problem is that server response with 500 error:
Can not deserialize instance of XXX out of START_ARRAY token
where xxx is the name of my custom form class.
Could somebody explain me where is the problem? Thank you
Here is my solution. Only thing you have to do is to create separate object at server side.
精彩评论