Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

After dragging this unit into the Flow canvas, double-click it to access its configuration options. The following table describes the configuration options of this unit:

Tab

Field

Description

General

Name

Enter a name for the unit. It must start with a letter, and cannot contain spaces. Only letters, numbers, and underscores are allowed.

Description

Enter a description detailing the scope of the unit.

Expression

A JQ valid expression that will determine the behavior of the unit.

Result type

The type of the expected result. JSON stands for JSON String. Java stands for generic java types (Map, List, String, ...).

In field

Enter the name of the input event field containing JSON data.

Out field

Enter a name for the output event field containing the result.

Input ports

Port

Description

in

Input events. Events must contain a field to be parsed.

Output ports

Port

Description

out

Outputs successful Input events, enriched with an extra field containing the parse result.

error

Outputs input events enriched with standard error fields.

Example

In this example, we want to format a JSON string to JQ JSON format and send it to a my.app data table.

...

First, we will use a Tick unit to send the fields when clicked.

In the Fields tab of the properties, we need to add values in JSON format so that it can be processed as a JQ JSON.

Enter the Type as string and in the Value field, the following JSON data:

Code Block
{
    "timestamp": 1234567890,
    "report": "Age Report",
    "results": [
        { "name": "John", "age": 43, "city": "TownA" },
        { "name": "Joe",  "age": 10, "city": "TownB" }
    ]
}

...

Then, we will link it to a JQ unit in order to format the string into JQ JSON format using an expression.

We use the following JQ valid expression in the Expression field:

Code Block
.results[] | select(.name | contains("Jo"))

and fill in the rest of the fields:

...

Finally, we will link its out output port to a Devo sink unit to send the formatted events to a my.app table.

Download this example

You can try this flow by downloading this JSON and uploading it to your domain using the Import option:

View file
nameJQ.json