jq - JSON processor

Apply a jq expression: https://stedolan.github.io/jq/

by @pixiebrix

What is jq?

jq is a powerful expression language for filtering and transforming structured JSON data

Helpful Resources

Brick Arguments

The jq brick takes two input arguments:

  • data: an object, array, or single value which is passed to jq
  • filter: the jq "filter", which controls how to filter/transform the data

Filter Examples

Creating a new object from the input

View on jqplay

{foo: 42, bar: .}

Parsing and summing values

View on jqplay

.transactions | map(.amount | capture("(?<val>\\d+) USD") | .val | tonumber) | add

Filtering an array

View on jqplay

Assign the query to a variable so you can use it in the select clause

.query as $query | [.items[] | select(.text == $query)]


Name Required Type Description
data unknown The input data, or blank to process the data from the previous step
filter string jq filter expression


Name Required Type Description
No outputs for this brick defined.

Related Tags