class JacksonUtils {

    public static JsonNode filterJsonNodeForPaths(JsonNode jsonNode, List<String> filterPaths) {
        ObjectMapper mapper = new ObjectMapper(new JsonFactory());

        JsonNode filteredNode;
        if(jsonNode instanceof ArrayNode)
            filteredNode = mapper.createArrayNode();
        else if(jsonNode instanceof ObjectNode)
            filteredNode = mapper.createObjectNode();
        else
            return null;

        for(String path : filterPaths) {
            JsonNode singlePathFilterNode = filterJsonNodeForPath(jsonNode, path);
            filteredNode = merge(singlePathFilterNode, filteredNode);
        }

        return filteredNode;
    }

}