Entity { @JsonAnyGetter public Map<String, Attribute> getAttributes() { return attributes; } Entity();  Entity(String id, String type);  Entity(String id, String type, Map<String, Attribute> attributes); String getId(); void setId(String id); String getType(); void setType(String type); @JsonAnyGetter Map<String, Attribute> getAttributes(); @JsonAnySetter void setAttributes(String key, Attribute attribute); @JsonIgnore void setAttributes(Map<String, Attribute> attributes);  }
@Test public void deserializationEntityTest() throws IOException { String jsonString = "{\n" + " \"id\" : \"Bcn-Welt\",\n" + " \"type\" : \"Room\",\n" + " \"temperature\" : {\n" + " \"value\" : 21.7\n" + " },\n" + " \"humidity\" : {\n" + " \"value\" : 60\n" + " }\n" + "}"; ObjectMapper objectMapper = new ObjectMapper().registerModule(new Jdk8Module()); Entity entity = objectMapper.readValue(jsonString, Entity.class); Attribute temp = entity.getAttributes().get("temperature"); assertEquals(0, temp.getMetadata().size()); }