Skip to content

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

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
Input args: [{"name":"Alice","age":30}]
Transforms: "jq:.name"
Output: "Alice"
Input args: [[{"name":"Alice"},{"name":"Mike"}]]
Transforms: "jq:.[].name"
Output: "Alice"
Input args: [[{"name":"Alice"},{"name":"Mike"}]]
Transforms: "jq(a):.[].name"
Output: ["Alice","Mike"]
Input args: [[1,2,3]]
Transforms: "jq:.[0]"
Output: 1
Input args: ["Alice",30]
Transforms: "jq:."
Output: ["Alice",30]