@Override
    public JsonNode visit(JmesPathFilter filter, JsonNode input) throws InvalidTypeException {
        JsonNode filterExpression = filter.getLhsExpr().accept(this, input);
        if (filterExpression.isArray()) {
            Iterator<JsonNode> elements = filterExpression.elements();
            ArrayNode projectedArrayNode = ObjectMapperSingleton.getObjectMapper().createArrayNode();
            while (elements.hasNext()) {
                JsonNode element = elements.next();
                if (filter.getComparator().accept(this, element).equals(BooleanNode.TRUE)) {
                    JsonNode projectedElement = filter.getRhsExpr().accept(this, element);
                    if (projectedElement != null) {
                        projectedArrayNode.add(projectedElement);
                    }
                }
            }
            return projectedArrayNode;
        }
        return NullNode.getInstance();
    }
@ Override public JsonNode visit ( JmesPathFilter filter , JsonNode input ) throws InvalidTypeException { JsonNode filterExpression = filter . getLhsExpr ( ) . accept ( this , input ) ; if ( filterExpression . isArray ( ) ) { Iterator < JsonNode > elements = filterExpression . elements ( ) ; ArrayNode projectedArrayNode = ObjectMapperSingleton . getObjectMapper ( ) . createArrayNode ( ) ; while ( elements . hasNext ( ) ) { JsonNode element = elements . next ( ) ; if ( filter . getComparator ( ) . accept ( this , element ) . equals ( BooleanNode . TRUE ) ) { JsonNode projectedElement = filter . getRhsExpr ( ) . accept ( this , element ) ; if ( projectedElement != null ) { projectedArrayNode . add ( projectedElement ) ; } } } return projectedArrayNode ; } return NullNode . getInstance ( ) ; }
Evaluates a filter expression as follows.
For each element in an array evaluate the expression against
the element. If the expression evaluates to a truth-like value,
the item (in its entirety) is added to the result list. Otherwise
it is excluded from the result list. A filter expression is
only defined for a JSON array. Attempting to evaluate a filter
expression against any other type will return null.

@param filter JmesPath filter type
@param input  Input json node against which evaluation is done
@return Result of the filter expression evaluation
@throws InvalidTypeException