MMMMS
MMMMS

Reputation: 2201

Can not deserialize instance of model class out of START_ARRAY token

I am trying to post json array list data to spring rest call and doing my logic like below,

Model Class :

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
}

Rest call :

@RequestMapping(value="/post/data", method = RequestMethod.POST,consumes = "application/json", produces = "application/json")
public List<ModelClass1> retrieveData(@RequestBody List<ABCDEF> dataFromUser){

return null;

}

Input tried :

[
{
"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"
}
]

But it throw Exception as,

nested exception is com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize instance of com.ABCDEF out of START_ARRAY token

where am i doing mistake here?

Upvotes: 0

Views: 871

Answers (1)

Ramanujan R
Ramanujan R

Reputation: 1719

Use jackson-databind jar.

May be you have done that seeing the exception, then you can refer this, saying this issue was fixed in Spring 3.2.

Refer this also

Upvotes: 1

Related Questions