SpringMVC 中向后台传入json数据报错

报错信息:spring

org.springframework.http.converter.HttpMessageNotReadableException: Could not read document: Unrecognized token 'XXXXXX': was expecting ('true', 'false' or 'null')

缘由: 提交form时候用错了方法。 错误:code

data : $("#XXXXXForm").serialize(),

正确:orm

data : toJson($("#XXXXXXForm")),

增长下面方法:token

function toJson($form) {
    var data = {};
    $($form.serializeArray()).each(function(i, v) {
        data[v.name] = v.value;
    });
    return JSON.stringify(data);
};
相关文章
相关标签/搜索