@Test public void checkIfNoFieldExistsInJsonNode() throws IOException { JsonNode originalNode = mapper.readTree("{\"tenantDetails\":{\"tenantId\":\"pb.amritsar\"}," + "\"name\":{\"firstName\":\"Customer Name\"}}"); List<String> fields = Arrays.asList("asd"); assertEquals(true, JacksonUtils.checkIfNoFieldExistsInJsonNode(originalNode, fields)); }
static boolean checkIfNoFieldExistsInJsonNode(JsonNode jsonNode, List<String> fields) { for(String field : fields) { if(! String.valueOf(jsonNode.findPath(field)).isEmpty()) return false; } return true; }
JacksonUtils { static boolean checkIfNoFieldExistsInJsonNode(JsonNode jsonNode, List<String> fields) { for(String field : fields) { if(! String.valueOf(jsonNode.findPath(field)).isEmpty()) return false; } return true; } }
JacksonUtils { static boolean checkIfNoFieldExistsInJsonNode(JsonNode jsonNode, List<String> fields) { for(String field : fields) { if(! String.valueOf(jsonNode.findPath(field)).isEmpty()) return false; } return true; }  }
JacksonUtils { static boolean checkIfNoFieldExistsInJsonNode(JsonNode jsonNode, List<String> fields) { for(String field : fields) { if(! String.valueOf(jsonNode.findPath(field)).isEmpty()) return false; } return true; }  static JsonNode merge(JsonNode newNode, JsonNode originalNode); static JsonNode filterJsonNodeForPaths(JsonNode jsonNode, List<String> filterPaths); static JsonNode filterJsonNodeWithFields(JsonNode jsonNode, List<String> filterFields); }
JacksonUtils { static boolean checkIfNoFieldExistsInJsonNode(JsonNode jsonNode, List<String> fields) { for(String field : fields) { if(! String.valueOf(jsonNode.findPath(field)).isEmpty()) return false; } return true; }  static JsonNode merge(JsonNode newNode, JsonNode originalNode); static JsonNode filterJsonNodeForPaths(JsonNode jsonNode, List<String> filterPaths); static JsonNode filterJsonNodeWithFields(JsonNode jsonNode, List<String> filterFields);  }