title: JsonMappingException: Unexpected token (START_OBJECT)
body: <p>I'm having problem with the user of Codehaus Jackson. I have an object with the next attributes and mapper declaration:</p>
  
  <pre><code>public class AuthenticatedPrincipal implements Serializable, Principal {
        @JsonIgnore
        private final static ObjectMapper mapper = new ObjectMapper().enable(DeserializationConfig.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY).enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL)
        .setSerializationInclusion(JsonSerialize.Inclusion.NON_NULL).setVisibility(JsonMethod.FIELD, JsonAutoDetect.Visibility.ANY);
  
    private String name;
  
    private Collection&lt;String&gt; roles;
  
    private Collection&lt;String&gt; groups;
  
    private boolean adminPrincipal;
  ...
    @JsonIgnore
    public String serialize() {
      try {
        return mapper.writeValueAsString(this);
      } catch (IOException e) {
        throw new RuntimeException("Unable to serialize Principal:" + toString(), e);
      }
    }
  
    @JsonIgnore
    public static AuthenticatedPrincipal deserialize(String json) {
      try {
        return mapper.readValue(json, AuthenticatedPrincipal.class);
      } catch (IOException e) {
        throw new RuntimeException("Unable to serialize Principal:" + json, e);
      }
    }
  }
  </code></pre>
  
  <p>That is used from another class:</p>
  
  <pre><code>public class AuthRequest {
  
    @Transient
    private AuthenticatedPrincipal principal;
    @PreUpdate
    @PrePersist
    public void encodePrincipal() {
      if (principal != null) {
          this.encodedPrincipal = principal.serialize();
      }
    }
  
    @PostLoad
    @PostPersist
    @PostUpdate
    public void decodePrincipal() {
      if (StringUtils.isNotBlank(encodedPrincipal)) {
          this.principal = AuthenticatedPrincipal.deserialize(encodedPrincipal);
      }
    }
  }
  </code></pre>
  
  <p>When I execute the funtionality that generate a String like this: </p>
  
  <pre><code>Principal:{"adminPrincipal":false,"displayName":"sdfas","groupAware":false,"name":"sdfas"}
  </code></pre>
  
  <p>When the method AuthenticatedPrincipal.deserialize(encodedPrincipal); is called parsing a Json parameter but that method fail with this error:</p>
  
  <pre><code>org.codehaus.jackson.map.JsonMappingException: Unexpected token (START_OBJECT), expected START_ARRAY: need JSON Array to contain As.WRAPPER_ARRAY type information for class com.trent.app.lib.principal.AuthenticatedPrincipal
   at [Source: java.io.StringReader@40fa255; line: 1, column: 1]
  </code></pre>
  
  <p>Can anyone help me?</p>