ajax请求,fastjson报出错误:syntax error, expect {, actual error, pos 0

版权声明:个人博客:yjz.life 欢迎前来交流!~本篇文章未经同意请勿转载! https://blog.csdn.net/m0_38072683/article/details/83959296

报错信息如下:

org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: syntax error, expect [, actual error, pos 0, fieldName null; nested exception is com.alibaba.fastjson.JSONException: syntax error, expect [, actual error, pos 0, fieldName null

将ajax请求的参数转换成字符串。

jsJSON.stringify方法将data对象转换成JSON字符串就可以了。

   $.ajax({
            data:JSON.stringify(data),
    });

猜你喜欢

转载自blog.csdn.net/m0_38072683/article/details/83959296