/** * Given a field name and a tree of json nodes, empty the contents of all the json nodes matching the field name. * This method is recursive. * * @param node The root of the tree of json nodes. * @param fieldName The name of the node to be omitted. * @param mapper The object mapper that creates and empty node. * * @deprecated Should avoid this method and instead use {@link #canonicalize(JsonNode, ObjectMapper, boolean)} * which preserves JSON object ordering that guarantees consistent hash values. */ @Deprecated public static void omitField(JsonNode node, String fieldName, ObjectMapper mapper) { if (node.has("context")) { ((ObjectNode) node).replace(fieldName, mapper.createObjectNode()); } for (JsonNode child : node) { omitField(child, fieldName, mapper); } }