I am trying to pass a JSON array into spring MVC Controller like such:
var myList = new Array();
data._children.forEach( function (d) {
You can try
@RequestParam("myList") myList tempmyList
@Param myList tempmyList
in addition, class names must begin with a capital letter.
Even I was facing same problem. My client request was right and generated proper json file. but still i was getting same error.
I solved this error using @JsonIgnoreProperties(ignoreUnknown = true) in pojo class.
refer this link. Spring MVC : The request sent by the client was syntactically incorrect
try to add this to you ajax call it should fix the unsupported response :
headers : {
'Accept' : 'application/json',
'Content-Type' : 'application/json'
},
this is a full example of ajax call that is working for me :
$.ajax({
dataType : "json",
url : this.baseurl + "/dataList",
headers : {
'Accept' : 'application/json',
'Content-Type' : 'application/json'
},
data : JSON.stringify(params),
type : 'POST',
success : function(data) {
self.displayResults(data);
},
error : function(jqXHR,textStatus,errorThrown ){
showPopupError('Error','error : ' + textStatus, 'ok');
}
});