前台数据新增时,报400错误
后台报错如下:
07-Sep-2020 10:08:07.062 警告 [http-nio-8080-exec-3] org.springframework.web.servlet.handler.AbstractHandlerExceptionResolver.logException Resolved [org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: Unrecognized token ‘name’: was expecting ‘null’, ‘true’, ‘false’ or NaN; nested exception is com.fasterxml.jackson.core.JsonParseException: Unrecognized token ‘name’: was expecting ‘null’, ‘true’, ‘false’ or NaN
at [Source: (PushbackInputStream); line: 1, column: 6]]
解决办法
//把html中获取的键值对,转换成json格式
temp = JSON.stringify(temp);