Java中JSon转换ArrayList遇到的异常

异常描述:

"exception": "org.springframework.http.converter.HttpMessageNotReadableException",
"message": "JSON parse error: Can not deserialize instance of java.util.ArrayList out of START_OBJECT token; nested exception is com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize instance of java.util.ArrayList out of START_OBJECT token\n at [Source: java.io.PushbackInputStream@1180a866; line: 1, column: 1]",


出现这种错误应该是json的格式错误;

json格式key:value

前台json传输:

[ ] 代表List,; {}表示对象

例如 List, 其中model表示一个对象 model(string,list);

json格式:

[

{
"modelName":"test",
"list":[
"id",
            "xxx"
]
}]

你可能感兴趣的:(java,arraylist,json,异常)