I am trying to map json dictionary of objects with known structure to POJO 
under jackson control:

import com.fasterxml.jackson.annotation.JsonProperty;


public class GetListOfRecordsResponse {

   @JsonProperty("recordsCount")

   private Integer recordsCount; // Works always


   @JsonProperty("records")

   private Map<String, GeneratedRecordObject> records = new HashMap<>(); // 
Should also work without "records" (see second json)

}


It works properly for following (fake) json response:

{

  "recordsCount": 2,

  "records": {

     "-1": {

       ...

     },

    "1": {

        ...

     }

}


How can I modify GetListOfRecordsResponse (*JsonProperty *attribute? Using 
another attribute?) to allow parsing following real world JSON response


{

  "recordsCount": 2,

   "-1": {

      ...

   },

   "1": {

      ...

   }

}



Removing  records does not work properly: the deserialized records is empty.

How can I solve this problem?

-- 
You received this message because you are subscribed to the Google Groups 
"jackson-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jackson-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jackson-user/5e323b8c-1288-40e4-a9b5-877da8d7fb90%40googlegroups.com.

Reply via email to