BETA: This component is experimental and therefore subject to change outside of major version releases.
Transforms and filters messages using jq queries.
Try out Bloblang
For better performance and improved capabilities try out native Benthos mapping with the bloblang processor.
The provided query is executed on each message, targeting either the contents
as a structured JSON value or as a raw string using the field
and the message is replaced with the query result.
Message metadata is also accessible within the query from the variable
This processor uses the gojq library, and therefore does not require jq to be installed as a dependency. However, this also means there are some differences in how these queries are executed versus the jq cli which you can read about here.
If the query does not emit any value then the message is filtered, if the query returns multiple values then the resulting message will be an array containing all values.
The full query syntax is described in jq's documentation.
Queries can fail, in which case the message remains unchanged, errors are logged, and the message is flagged as having failed, allowing you to use standard processor error handling patterns.
The jq query to filter and transform messages with.
Whether to process the input as a raw string instead of as JSON.
When receiving JSON documents of the form:
We could collapse the location names from the state of Washington into a field
With the following config: