= jmespath
:type: processor
:status: stable
:categories: ["Mapping"]



////
     THIS FILE IS AUTOGENERATED!

     To make changes, edit the corresponding source file under:

     https://github.com/redpanda-data/connect/tree/main/internal/impl/<provider>.

     And:

     https://github.com/redpanda-data/connect/tree/main/cmd/tools/docs_gen/templates/plugin.adoc.tmpl
////

// © 2024 Redpanda Data Inc.


component_type_dropdown::[]


Executes a http://jmespath.org/[JMESPath query] on JSON documents and replaces the message with the resulting document.

```yml
# Config fields, showing default values
label: ""
jmespath:
  query: "" # No default (required)
```

[TIP]
.Try out Bloblang
====
For better performance and improved capabilities try native Benthos mapping with the xref:components:processors/mapping.adoc[`mapping` processor].
====


== Fields

=== `query`

The JMESPath query to apply to messages.


*Type*: `string`


== Examples

[tabs]
======
Mapping::
+
--


When receiving JSON documents of the form:

```json
{
  "locations": [
    {"name": "Seattle", "state": "WA"},
    {"name": "New York", "state": "NY"},
    {"name": "Bellevue", "state": "WA"},
    {"name": "Olympia", "state": "WA"}
  ]
}
```

We could collapse the location names from the state of Washington into a field `Cities`:

```json
{"Cities": "Bellevue, Olympia, Seattle"}
```

With the following config:

```yaml
pipeline:
  processors:
    - jmespath:
        query: "locations[?state == 'WA'].name | sort(@) | {Cities: join(', ', @)}"
```

--
======


