Spring mvc unsupported media type when used with @RequestBody and Jackson

Make sure you set the content type as ‘application/json’. Here is an example:

jQuery.ajax({
‘type’: ‘POST’,
‘url’: url,
‘contentType’: ‘application/json’,
‘data’: JSON.stringify(data),
‘dataType’: ‘html’,
‘success’: callback,
‘error’:function() {
error(‘failed making postJSON to ‘+url);
}
});