I'm getting START_ARRAY error for following model. I'm expecting object of InputDetails
class InputDetails{
public List<EachFieldDetails> fieldDetails;
}
class EachFieldDetails{
public String fieldName;
public String value;
}
JSON input is as follows:
[{"fieldName":"siteName","value":"Warehouse"},{"fieldName":"poNumber","value":"po1"},{"fieldName":"itemCode","value":"itemcode1"},{"fieldName":"asdnSerialNo","value":"null"}]
Can someone provide me the solution.
Here is my class
public Response setWHDetails(@BeanParam RequestBean requestBean,InputDetails saveInputs)
{
//Do operation
}
Your JSON specifies an array while you're trying to deserialize into an object.
if your JSON was like:
{
"fieldDetails" : [
{"fieldName":"siteName","value":"Warehouse"},
{"fieldName":"poNumber","value":"po1"},
{"fieldName":"itemCode","value":"itemcode1"},
{"fieldName":"asdnSerialNo","value":"null"}
]
}
It would probably work. Alternately, you could deserialize directly into an array.
I say probably because you haven't provided any code or information of what tool or library you're using to handle the deserialization process.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments