Spring-boot RestAPI post org.springframework.http.converter.HttpMessageNotReadableException

时间:2017-06-26 03:16:50

标签: java json spring spring-mvc

我的github代码https://github.com/prabhatpankaj/SpringREST_API/

enter image description here

输出

output { "timestamp": 1498443503678, "status": 400, "error": "Bad Request", "exception": "org.springframework.http.converter.HttpMessageNotReadableEx‌​ception", "message": "JSON parse error: Can not deserialize instance of com.exaple.objects.User out of START_ARRAY token; nested exception is com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize instance of com.exaple.objects.User out of START_ARRAY token\n at [Source: java.io.PushbackInputStream@1546ea93; line: 1, column: 1]", "path": "/api/user/" }

1 个答案:

答案 0 :(得分:0)

看起来你发送的是用户数组JSON而不是一个用户。

从您发送的JSON中删除[],然后再试一次