json.jq
This function applies a query to the parsed JSON object and returns a filtered array. For more information, see https://jqlang.github.io/jq/manual/.
Syntax
json.jq(JSONobject, "query")
Arguments
Argument |
Type |
Description |
---|---|---|
|
any |
The JSON object. |
|
string |
The query using which the JSON object is filtered. |
Returns
Type |
Description |
---|---|
|
The filtered JSON array is the result. |
Examples
Let us say the jsonObject
includes the following:
jsonObject =
{
"colors":
[
{ "id": 1, "value": "red" },
{ "id": 2, "value": "green" },
{ "id": 3, "value": "blue" }
]
}
In this case, the json.jq(jsonObject, ".colours| .[0] |.value")
function returns "red"
.