json.jq
This function applies a query to the JSON object parsed and returns a filtered array. For more information, see https://jqlang.github.io/jq/manual/.
Syntax
json.jq(JSONobject, "query")
Arguments
Argument |
Type |
Description |
---|---|---|
jsonObject |
any |
The JSON object. |
query |
string |
The query using which the JSON object is filtered. |
Returns
Type |
Description |
---|---|
array |
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 function
json.jq(jsonObject, ".colours| .[0] |.value")
returns"red"
.