Have an array, when the size is 1, the json data I received does NOT contains []; like
{"firstname":"tom"}
when the size is larger than 1, the data I received contains [], like
[{"firstname":"tom"},{"firstname":"robert"}]
Currently my class contains an array property
String[] firstname;
//getter setter omit here
Code to handle this likes
ObjectMapper mapper = new ObjectMapper();
MyClass object = mapper.readValue(json, MyClass.class);
When the size is larger than 1, the deserialization works. However when size is 1, the deserialization failed.
I am currently using jackson, any solution for this problem?
I am wondering if jackson/gson or any other library can handle this?