title: Jersey: Can not deserialize instance of ArrayList out of String
body: <p>I have a json based REST Web Service implemented using:
  Jetty, Jersey, Jersey-JSON using Jackson.</p>
  
  <p>One of my methods receives a Person instance, which has a field of type List&lt;String&gt;.
  i.e.:</p>
  
  <pre><code>Public class Person {
      List&lt;String&gt; names;
  }
  </code></pre>
  
  <p>If I call it with an array of names, all works ok! e.g.:</p>
  
  <pre><code>{ "names" : [ "Jhon", "Doe" ] }
  </code></pre>
  
  <p>But if the person has only one name, my client creates a single value element, e.g.:</p>
  
  <pre><code>{ "names" : "Jhon" } 
  </code></pre>
  
  <p>When I try to call the service with a single value, I get an exception:</p>
  
  <pre><code>Can not deserialize instance of java.util.ArrayList out of VALUE_STRING token
  </code></pre>
  
  <p><strong>Question:</strong></p>
  
  <p>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.</p>
  
  <p>--</p>
  
  <p>I already read:</p>
  
  <p><a href="https://stackoverflow.com/questions/10978748/jackson-deserialization-with-contained-arraylistt">Jackson deserialization - with contained ArrayList&lt;T&gt;</a></p>
  
  <p>and</p>
  
  <p><a href="https://stackoverflow.com/questions/2199453/how-can-i-customize-serialization-of-a-list-of-jaxb-objects-to-json/3143214#3143214">How can I customize serialization of a list of JAXB objects to JSON?</a></p>
  
  <p>and this that refer the last answer:</p>
  
  <p><a href="https://stackoverflow.com/questions/13775881/jersey-client-can-not-deserializable-json-services-exceptioncan-not-deseriali">Jersey client can not deserializable json services - exception(can not deserialize instance)</a></p>
  
  <p><a href="https://stackoverflow.com/questions/6386873/jaxb-json-missing-brackets-for-one-element-array">Jaxb json missing brackets for one element array</a></p>
  
  <p>But none of those fix the problem.</p>
  
  <p>Thank you in advance!</p>