jmespath
Written as jmespath(argnum flags):options in a transform expression.
| Minimum arguments | 1 |
| Maximum arguments | no limit |
| Default arguments | 1 |
| Argument modes | SINGLE_PRIMITIVE, SINGLE_ARRAY, SINGLE_DICT, MULTIPLE_ARRAYS, MULTIPLE_DICTS |
Documentation
Section titled “Documentation”Extract data from JSON or converting JSON data using JMESPath queries with flexible input handling.
Features:
- Supports standard JMESPath syntax (https://jmespath.org/)
- Automatically handles both JSON strings and parsed JSON objects
- Flexible input handling based on argument count (can be disabled with ‘d’ flag)
Behavior by default (without ‘d’ flag):
- With 1 argument: Uses that single argument as the JSON input
- With multiple arguments: Uses the list of arguments as the JSON input
Use the ‘d’ flag to always treat input as a list of arguments regardless of count.
| Flag | Letter |
|---|---|
| spread_input | s |
| spread_output | S |
| noncaptive_input | I |
| arg_num_flexible | f |
| no_arg_discriminate | d |
Examples
Section titled “Examples”Single JSON object input
Section titled “Single JSON object input”Input args: [{"user":{"name":"Alice","age":30}}]Transforms: "jmespath:user.name"Output: "Alice"Multiple arguments treated as list
Section titled “Multiple arguments treated as list”Input args: ["Alice",30]Transforms: "jmespath:[0]"Output: "Alice"With d flag (disables discrimination)
Section titled “With d flag (disables discrimination)”Input args: [{"name":"Alice"}]Transforms: "jmespath(d):@"Output: [{"name":"Alice"}]Complex JMESPath query
Section titled “Complex JMESPath query”Input args: [{"users":[{"name":"Alice"},{"name":"Bob"}]}]Transforms: "jmespath:users[*].name"Output: ["Alice","Bob"]