title: Cannot deserialize instance of object out of START_ARRAY token in Spring Webservice
body: <p>I'm currently having trouble connecting to my webservice on android. I use jackson-core/databind/annotation-2.2.4 and Spring RESTWebService. If I access the URL from the browser I can see the JSON response: (server return List\Shop\ looks like:)</p>
  
  <pre><code>[{"name":"shopqwe","mobiles":[],"address":{"town":"city",
  "street":"streetqwe","streetNumber":"59","cordX":2.229997,"cordY":1.002539},
  "shoe" [{"shoeName":"addidas","number":"631744030","producent":"nike","price":999.0,
  "sizes":[30.0,35.0,38.0]}]
  </code></pre>
  
  <p>From a Client endpoint (Android application) I receive this error message:</p>
  
  <pre><code>08-26 17:43:07.406: E/AllShopsAsyc(28203): Could not read JSON: Can not deserialize
  instance of com.auginzynier.data.ShopContainer out of START_ARRAY token
  08-26 17:43:07.406: E/AllShopsAsyc(28203):  at [Source:
  com.android.okhttp.internal.http.HttpTransport$ChunkedInputStream@41efbd48; line: 1,
  column: 1]; nested exception is com.fasterxml.jackson.databind.JsonMappingException:
  Can not deserialize instance of com.auginzynier.data.ShopContainer out of START_ARRAY
  token
  08-26 17:43:07.406: E/AllShopsAsyc(28203):  at [Source:
  com.android.okhttp.internal.http.HttpTransport$ChunkedInputStream@41efbd48; line: 1,
  column: 1] 
  08-26 17:43:07.406: E/AllShopsAsyc(28203):
  org.springframework.http.converter.HttpMessageNotReadableException: Could not read
  JSON: Can not deserialize instance of com.auginzynier.data.ShopContainer out of
  START_ARRAY token
  </code></pre>
  
  <p>My server request</p>
  
  <pre><code>RestTemplate restTemplate = new RestTemplate();
  restTemplate.getMessageConverters().add(new MappingJackson2HttpMessageConverter());
  ShopContainer response  = restTemplate.getForObject(url, ShopContainer.class);
  </code></pre>
  
  <p>where ShopContainer is:</p>
  
  <pre><code>public class ShopContainer {
     private List&lt;Shop&gt; shops;
  </code></pre>
  
  <p>structure of Shop, Address and Shoe is : (I've omitted getters and setters):</p>
  
  <pre><code>public class Shop {
  @JsonProperty("name")    private String name;
  @JsonProperty("mobiles")   private List&lt;String&gt; mobiles = new ArrayList&lt;String&gt;();
  @JsonProperty("address")   private Address address;
  @JsonProperty("shoe") private List&lt;Shoe&gt; shoe = new ArrayList&lt;Shoe&gt;();
  
  public class Address {
  @JsonProperty("town") private String town;
  @JsonProperty("street") private String street;
  @JsonProperty("streetNumber") private String streetNumber;
  @JsonProperty("cordX") private Double cordX;
  @JsonProperty("cordY") private Double cordY;
  
  public class Shoe {
  @JsonProperty("shoeName") private String shoeName;
  @JsonProperty("number") private String number;
  @JsonProperty("producent") private String producent;
  @JsonProperty("price") private Double price;
  @JsonProperty("sizes") private List&lt;Double&gt; sizes = new ArrayList&lt;Double&gt;();
  </code></pre>
  
  <p>I've look here and on google but still can't figure out what I am missing at this point.</p>
  
  <p>Any response would be greatly helpful.</p>
  
  <p>Regards.</p>
  
  <p><strong>@UPDATE</strong> </p>
  
  <p>I've fixed the JSON by using jackson's ObjectMapper with RequestMethod.GET. It now returns a String.</p>
  
  <pre><code>list is List&lt;Shop&gt;
  
  ObjectMapper mapper = new ObjectMapper();
  mapper.writeValue(new File("D:\\Android\\shop.json"), list);
  System.out.println(mapper.writerWithDefaultPrettyPrinter().writeValueAsString(list));
  return mapper.writerWithDefaultPrettyPrinter().writeValueAsString(list);
  </code></pre>
  
  <p>JSON in console looks like:</p>
  
  <pre><code>[ {
    "name" : "shopqwe",
    "mobiles" : [ ],
    "address" : {
      "town" : "city",
      "street" : "streetqwe",
      "streetNumber" : "59",
      "cordX" : 2.229997,
      "cordY" : 2.002539
    },
    "shoe" : [ {
      "shoeName" : "addidas",
      "number" : "631744033",
      "producent" : "nike",
      "price" : 10.0,
      "sizes" : [ 30.0, 35.0, 38.0 ]
    } ]
  } ]
  </code></pre>
  
  <p>Request still doesn't work - error is the same.</p>