KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have a json based REST Web Service implemented using: Jetty, Jersey, Jersey-JSON using Jackson. One of my methods receives a Person instance, which has a field of type List<String>. i.e.: Public class Person { List<String> names; } If I call it with an array of names, all works ok! e.g.: { "names" : [ "Jhon", "Doe" ] } But if the person has only one name, my client creates a single value element, e.g.: { "names" : "Jhon" } When I try to call the service with a single value, I get an exception: Can not deserialize instance of java.util.ArrayList out of VALUE_STRING token Question: How should I create/configure my web service, in order to be able to deserialize array field when they are sent to me as a single element. -- I already read: Jackson deserialization - with contained ArrayList<T> and How can I customize serialization of a list of JAXB objects to JSON? and this that refer the last answer: Jersey client can not deserializable json services - exception(can not deserialize instance) Jaxb json missing brackets for one element array But none of those fix the problem. Thank you in advance!
Tags (comma-separated)
Save Edits
Cancel