Search code examples
javajsonjacksonobjectmapper

How to skip a map of map when deserialize from Json String to Object using object mapper


I have a map of map in my POJO which is always null. When i convert a json string to java object, then i am getting a deserialization error because of the map. So how can i skip the map while converting the json string to object


Solution

  • one of those will probably solve the problem:

    1. you may define the field transient, like:

      private transient Map<String, String> mapOfSomething;
      
    2. (or) you can add @JsonIgnore annotation, like:

      @JsonIgnore
      private Map<String, String> mapOfAnotherThing;