jmespath
Executes a JMESPath query on JSON documents and replaces the message with the resulting document.
# Config fields, showing default values
label: ""
jmespath:
query: "" # No default (required)
yml
Try out Bloblang
For better performance and improved capabilities try native Redpanda Connect mapping with the |
Examples
-
Mapping
When receiving JSON documents of the form:
{
"locations": [
{"name": "Seattle", "state": "WA"},
{"name": "New York", "state": "NY"},
{"name": "Bellevue", "state": "WA"},
{"name": "Olympia", "state": "WA"}
]
}
json
We could collapse the location names from the state of Washington into a field Cities
:
{"Cities": "Bellevue, Olympia, Seattle"}
json
With the following config:
pipeline:
processors:
- jmespath:
query: "locations[?state == 'WA'].name | sort(@) | {Cities: join(', ', @)}"
yaml
Was this helpful?