JMESPath Tester

JMESPath is part of n8n since version 0.167.0

Just in case you want to test it’s queries …


How do you reference the json in a function node? I love JMESpath but not sure how to use the new functionality.

Hi @djangelic I haven’t updated to the latest version of n8n yet, so I honestly do not know how this works yet. However, I’ve been playing around with jmespath in VS Code, and there it works as follows:

var jmespath = require("jmespath");

let data = {
  "locations": [
    {"name": "Seattle", "state": "WA"},
    {"name": "New York", "state": "NY"},
    {"name": "Bellevue", "state": "WA"},
    {"name": "Olympia", "state": "WA"}

let result =, "locations[].{city: name}")


And in this example the result is:

  { city: 'Seattle' },
  { city: 'New York' },
  { city: 'Bellevue' },
  { city: 'Olympia' }

Hi @djangelic apparently it’s already possible in the DeskTop App as JMESPath in already in the nodes modules. You just have to add it to your n8n-desktop environment.


Here’ an example of data transformation:

let data = item

var jmespath = require("jmespath");

let result =, "locations[].{city: name}")

return result

And this is an example workflow of this code with sample data:

The only thing you’ve go to do, is replace the QUERY:

let result =, "QUERY")

with the code you can find at

Try for example:

let result =, "locations[?state == 'WA'].name | sort(@)[-2:] | {WashingtonCities: join(', ', @)}")

and see what happens :sunglasses:


Awesome, thanks for the very clear write up! Looking forward to testing it!