Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Test {
- /**
- * I want array be ignored, only taking into account keys
- */
- private static String JSON = "{\"property\":{\"key1\": {}, \"key2\": {}, \"array\":[1, 2]}}";
- @JsonIgnoreProperties(ignoreUnknown = true)
- private static class MyBean {
- private Map<String, Map<String, String>> property;
- public Map<String, Map<String, String>> getProperty() {
- return property;
- }
- public void setProperty(Map<String, Map<String, String>> property) {
- this.property = property;
- }
- }
- public static void main(String[] args) throws IOException {
- ObjectMapper objectMapper = new ObjectMapper();
- objectMapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
- objectMapper.readValue(JSON, MyBean.class);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement