Implementation of the JMES Path JSON Query language for Java
—
The primary visitor implementation that evaluates JMESPath expressions against JSON data. This is the main execution engine that processes expression trees and returns JSON results.
The concrete visitor implementation that evaluates all expression types against JsonNode input data.
public class JmesPathEvaluationVisitor implements JmesPathVisitor<JsonNode, JsonNode> {
/**
* Creates a new evaluation visitor for processing expressions
*/
public JmesPathEvaluationVisitor();
}Retrieves field values from JSON objects with camelCase conversion support.
public JsonNode visit(JmesPathField fieldNode, JsonNode input) {
/**
* Evaluates field access on the input JSON node
* @param fieldNode The field expression to evaluate
* @param input The JSON object to access
* @return The field value or null if not found/invalid type
*/
}Implementation Details:
NullNode if input is not an object or field not foundReturns the input node unchanged.
public JsonNode visit(JmesPathIdentity jmesPathIdentity, JsonNode input) {
/**
* Returns the input node as-is
* @param jmesPathIdentity The identity expression
* @param input The input JSON node
* @return The input node unchanged
*/
}Returns the literal value stored in the expression.
public JsonNode visit(JmesPathLiteral literal, JsonNode input) {
/**
* Returns the literal value
* @param literal The literal expression containing the value
* @param input The input JSON node (ignored)
* @return The literal value as JsonNode
*/
}Evaluates chained expressions in sequence, passing results between expressions.
public JsonNode visit(JmesPathSubExpression subExpression, JsonNode input) throws InvalidTypeException {
/**
* Evaluates a chain of expressions sequentially
* @param subExpression The sub-expression containing chained expressions
* @param input The initial input JSON node
* @return The result of the final expression in the chain
* @throws InvalidTypeException If any expression evaluation fails
*/
}Implementation Details:
Evaluates multiple expressions against the same input and returns an array of results.
public JsonNode visit(JmesPathMultiSelectList multiSelectList, JsonNode input) throws InvalidTypeException {
/**
* Evaluates multiple expressions and collects results into an array
* @param multiSelectList The multi-select expression containing sub-expressions
* @param input The input JSON node to evaluate against
* @return ArrayNode containing results from all expressions
* @throws InvalidTypeException If any expression evaluation fails
*/
}Evaluates list projections by applying an expression to each element of an array.
public JsonNode visit(JmesPathProjection jmesPathProjection, JsonNode input) throws InvalidTypeException {
/**
* Evaluates list projection expressions
* @param jmesPathProjection The projection expression
* @param input The input JSON node
* @return ArrayNode with projection results, or NullNode if input not array
* @throws InvalidTypeException If expression evaluation fails
*/
}Implementation Details:
NullNode if LHS result is not an arrayEvaluates object value projections by creating a list from object values and projecting over them.
public JsonNode visit(JmesPathValueProjection valueProjection, JsonNode input) throws InvalidTypeException {
/**
* Evaluates object value projection expressions
* @param valueProjection The value projection expression
* @param input The input JSON node
* @return ArrayNode with projection results, or NullNode if input not object
* @throws InvalidTypeException If expression evaluation fails
*/
}Evaluates filter expressions by testing each array element against a condition.
public JsonNode visit(JmesPathFilter filter, JsonNode input) throws InvalidTypeException {
/**
* Evaluates filter expressions on arrays
* @param filter The filter expression with condition
* @param input The input JSON node
* @return ArrayNode with filtered results, or NullNode if input not array
* @throws InvalidTypeException If expression evaluation fails
*/
}Implementation Details:
BooleanNode.TRUE are includedEvaluates logical AND and NOT expressions with short-circuit behavior.
public JsonNode visit(JmesPathAndExpression andExpression, JsonNode input) throws InvalidTypeException {
/**
* Evaluates logical AND expressions
* @param andExpression The AND expression with left and right operands
* @param input The input JSON node
* @return RHS result if LHS is true, otherwise LHS result
* @throws InvalidTypeException If expression evaluation fails
*/
}
public JsonNode visit(JmesPathNotExpression notExpression, JsonNode input) throws InvalidTypeException {
/**
* Evaluates logical NOT expressions
* @param notExpression The NOT expression with operand
* @param input The input JSON node
* @return BooleanNode.TRUE if operand is falsy, BooleanNode.FALSE otherwise
* @throws InvalidTypeException If expression evaluation fails
*/
}Flattens nested arrays by one level.
public JsonNode visit(JmesPathFlatten flatten, JsonNode input) throws InvalidTypeException {
/**
* Evaluates array flattening expressions
* @param flatten The flatten expression
* @param input The input JSON node
* @return Flattened ArrayNode, or NullNode if input not array
* @throws InvalidTypeException If expression evaluation fails
*/
}Implementation Details:
Evaluates function expressions by processing arguments and calling the function's evaluate method.
public JsonNode visit(JmesPathFunction function, JsonNode input) throws InvalidTypeException {
/**
* Evaluates function expressions in applicative order
* @param function The function expression with arguments
* @param input The input JSON node
* @return The result of the function evaluation
* @throws InvalidTypeException If function evaluation fails
*/
}Implementation Details:
evaluate method with evaluated argumentsEvaluates comparison expressions by comparing left and right operands.
public JsonNode visit(Comparator op, JsonNode input) throws InvalidTypeException {
/**
* Evaluates comparison expressions
* @param op The comparison operator
* @param input The input JSON node
* @return BooleanNode.TRUE if comparison matches, BooleanNode.FALSE otherwise
* @throws InvalidTypeException If expression evaluation fails
*/
}Install with Tessl CLI
npx tessl i tessl/maven-com-amazonaws--jmespath-java