title: Jackson deserialization - with contained ArrayList<T>
body: <p>Good day, </p>
  
  <p>I am currently integration attempting to consume a REST service that produces JSON (written in .NET) using Jackson (with Jersey). The JSON consists of a possible error message and an array of objects. Below is a sample of the JSON returned as produced by Jersey's logging filter:</p>
  
  <pre><code>{
      "error":null,
      "object":"[{\"Id\":16,\"Class\":\"ReportType\",\"ClassID\":\"4\",\"ListItemParent_ID\":4,\"Item\":\"Pothole\",\"Description\":\"Pothole\",\"Sequence\":1,\"LastEditDate\":null,\"LastEditor\":null,\"ItemStatus\":\"Active\",\"ItemColor\":\"#00AF64\"}]"
  }
  </code></pre>
  
  <p>I have two classes to represent the type (the outer ListResponse):</p>
  
  <pre><code>public class ListResponse { 
  
      public String error;    
      public ArrayList&lt;ListItem&gt; object;  
  
      public ListResponse() { 
      }
  }
  </code></pre>
  
  <p>and (the inner ListItem):</p>
  
  <pre><code>public class ListItem {
      @JsonProperty("Id")
      public int id;      
      @JsonProperty("Class")
      public String classType;
      @JsonProperty("ClassID")
      public String classId;  
      @JsonProperty("ListItemParent_ID")
      public int parentId;    
      @JsonProperty("Item")
      public String item; 
      @JsonProperty("Description")
      public String description;
  
      @JsonAnySetter 
      public void handleUnknown(String key, Object value) {}
  
      public ListItem() {
      }
  }
  </code></pre>
  
  <p>The class that invokes and returns the JSON looks like this: </p>
  
  <pre><code>public class CitizenPlusService {
      private Client client = null;   
      private WebResource service = null;     
  
      public CitizenPlusService() {
          initializeService("http://localhost:59105/PlusService/"); 
      }
  
      private void initializeService(String baseURI) {    
          // Use the default client configuration. 
          ClientConfig clientConfig = new DefaultClientConfig();      
          clientConfig.getClasses().add(JacksonJsonProvider.class);                       
  
          client = Client.create(clientConfig);
  
          // Add a logging filter to track communication between server and client. 
          client.addFilter(new LoggingFilter()); 
          // Add the base URI
          service = client.resource(UriBuilder.fromUri(baseURI).build()); 
      }
  
      public ListResponse getListItems(String id) throws Exception
      {           
          ListResponse response = service.path("GetListItems").path(id).accept(MediaType.APPLICATION_JSON_TYPE, MediaType.APPLICATION_XML_TYPE).get(ListResponse.class);                                  
          return response;            
      }
  }
  </code></pre>
  
  <p>The important call here is the getListItems method. Running the code in a test harness, produces the following:</p>
  
  <pre><code>org.codehaus.jackson.map.JsonMappingException: Can not deserialize instance of java.util.ArrayList out of VALUE_STRING token
  at [Source: java.io.StringReader@49497eb8; line: 1, column: 14] (through reference chain: citizenplus.types.ListResponse["object"])
  </code></pre>
  
  <p>Please assist. </p>
  
  <p>Regards,
  Carl-Peter Meyer</p>