【发布时间】:2016-12-09 08:43:22
【问题描述】:
我正在尝试将 json 数组列表数据发布到 spring rest 调用并执行如下逻辑,
模型类:
public class ABCDEF{
private String A;
private String B;
private ArrayList<Long> C;
private ArrayList<Long> D;
private ArrayList<String> E;
private String F;
//getter //setter
}
休息电话:
@RequestMapping(value="/post/data", method = RequestMethod.POST,consumes = "application/json", produces = "application/json")
public List<ModelClass1> retrieveData(@RequestBody List<ABCDEF> dataFromUser){
return null;
}
输入尝试:
[
{
"A" : "something",
"B":"something",
"C":[1],
"D": [1,2],
"E":["123","1234"],
"F":"something"
},
{
"A" : "something",
"B":"something",
"C":[4,5],
"D": [7,8,9],
"E":["1111","9999"],
"F":"something"
}
]
但它会抛出异常,
nested exception is com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize instance of com.ABCDEF out of START_ARRAY token
我在哪里做错了?
【问题讨论】:
标签: json spring-mvc