jq - JSON processor
Apply a jq expression: https://stedolan.github.io/jq/
Demos & Screenshots
No screenshots provided yet. Have some video demos or screenshots of this
brick
in the wild?
Send them over to
[email protected]!
How to Use
What is jq?
jq is a powerful expression language for filtering and transforming structured JSON data
Helpful Resources
- jqplay: A playground for jq 1.6
- jq Manual: has runnable examples of each operator
- jq Homepage
- jq tag on StackOverflow
Brick Arguments
The jq brick takes two input arguments:
data
: an object, array, or single value which is passed to jqfilter
: the jq "filter", which controls how to filter/transform the data
Filter Examples
Creating a new object from the input
{foo: 42, bar: .}
Parsing and summing values
.transactions | map(.amount | capture("(?<val>\\d+) USD") | .val | tonumber) | add
Filtering an array
Assign the query to a variable so you can use it in the select
clause
.query as $query | [.items[] | select(.text == $query)]
Inputs
Name | Required | Type | Description |
---|---|---|---|
data |
unknown
|
The input data, or blank to process the data from the previous step | |
filter |
string
|
jq filter expression |
Outputs
Name | Required | Type | Description |
---|---|---|---|
No outputs for this brick defined. |
Details
ID | @pixiebrix/jq |
---|---|
Author |
@pixiebrix
|
Version | 1.7.0 |
Created | Aug. 17, 2021 |
Updated | June 13, 2022 |