jq
Written as jq(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 content using JQ expressions.
Features:
- Supports standard JQ syntax (https://jqlang.org/manual/)
- Automatically handles both JSON strings and parsed JSON objects
- Flexible input handling based on argument count (can be disabled with ‘d’ flag)
- Recommended over Keypath transform and JMESpath transform
[Input args handling behavior]
- without ‘d’ flag: a. with 1 argument: uses that single argument as the JSON input b. with multiple arguments: uses the list of arguments as the JSON input
- with ‘d’ flag: always treat input as a list of arguments regardless of count.
[Query result retrieval behavior]
- without ‘a’ flag: get first if the jq query matches multiple results from different result paths. Note this doesn’t affect the retrieval of a single list value on the first result path.
- with ‘a’ flag: always retrieve results from all paths, and in this case the transform return value is always a list, and specifically a single-element list if only one result path is found.
| Flag | Letter |
|---|---|
| spread_input | s |
| spread_output | S |
| noncaptive_input | I |
| arg_num_flexible | f |
| no_arg_discriminate | d |
| result_all | a |
Examples
Section titled “Examples”Basic JQ query
Section titled “Basic JQ query”Input args: [{"name":"Alice","age":30}]Transforms: "jq:.name"Output: "Alice"Selects the first result by default
Section titled “Selects the first result by default”Input args: [[{"name":"Alice"},{"name":"Mike"}]]Transforms: "jq:.[].name"Output: "Alice"Select all results with flag a
Section titled “Select all results with flag a”Input args: [[{"name":"Alice"},{"name":"Mike"}]]Transforms: "jq(a):.[].name"Output: ["Alice","Mike"]Array access with JQ
Section titled “Array access with JQ”Input args: [[1,2,3]]Transforms: "jq:.[0]"Output: 1JQ with multiple arguments
Section titled “JQ with multiple arguments”Input args: ["Alice",30]Transforms: "jq:."Output: ["Alice",30]