title: spring-boot jackson single object as array
body: <p>I am having an issue with resolving a single object as an array I have used the following property </p>
  
  <pre><code># JACKSON (JacksonProperties).
  spring.jackson.deserialization.ACCEPT_SINGLE_VALUE_AS_ARRAY=true
  </code></pre>
  
  <p>In addition to the above I have configured a rest template as follows:</p>
  
  <pre><code>@Test
      public void testSingleObject() {
          RestTemplate restTemplate = new RestTemplate();
           ObjectMapper mapper = new ObjectMapper();
          MappingJackson2HttpMessageConverter convertor = new MappingJackson2HttpMessageConverter();
          convertor.setObjectMapper(mapper);
          mapper.enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
          restTemplate.getMessageConverters().add(convertor);
          MockRestServiceServer mockServer = MockRestServiceServer.createServer(restTemplate);
          mockServer.expect(requestTo("/test/1")).andExpect(method(HttpMethod.GET))
                  .andRespond(withSuccess("{\"size\":\"1\",\"Value\":{\"@id\": \"1\",\"description\":\"Some Text\"}}", MediaType.APPLICATION_JSON));
         // JsonNode jsonNode = restTemplate.getForObject("/test/{id}", JsonNode.class, 1);
          mycalss value = restTemplate.getForObject("/test/{id}", myclass.class, 1);
          System.out.print(value.toString());
      }
  </code></pre>
  
  <p>I am using spring-boot 1.3.2, the error I get is </p>
  
  <pre><code>Could not read document: Can not deserialize instance of java.util.ArrayList out of START_OBJECT token
  </code></pre>
  
  <p>Ps: If I try this without rest template it works as expected </p>
  
  <pre><code>@Test
      public void testSingleObject3() throws IOException {
          final String json = "{\"size\":\"1\",\"Value\":{\"@id\": \"1\",\"description\":\"Some Text\"}}";
  
          final ObjectMapper mapper = new ObjectMapper()
                  .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
          myclass value = mapper.readValue(json,
                  new TypeReference&lt;myclass&gt;() {
          });
          System.out.println(value.toString());
      }
  </code></pre>
  
  <p>my class is defined a follows :</p>
  
  <pre><code>//@JsonFormat(with = JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY)
  @JsonInclude(JsonInclude.Include.NON_NULL)
  public class myclass {
  @JsonProperty("size")
  private String Size;
  @JsonProperty("value")
  private List&lt;mysubclass&gt; mysubclass;
  @JsonIgnore
  private Map&lt;String, Object&gt; additionalProperties = new HashMap&lt;String, Object&gt;(); 
  //... setters and getters 
  </code></pre>
  
  <p>mysubclass is defined as follows:</p>
  
  <pre><code>@JsonInclude(JsonInclude.Include.NON_NULL)
  @JsonPropertyOrder({
  "id",
  "description"
  })
  public class mysubclass {
  
  @JsonProperty("@id")
  private String Id;
  @JsonProperty("description")
  private String description;
  @JsonIgnore
  private Map&lt;String, Object&gt; additionalProperties = new HashMap&lt;String, Object&gt;();
  </code></pre>
  
  <p>Regards</p>