Jmespath filtering with variable in expression not working

Describe the issue/error/question

Via jmespath I want to use a filter expression that contains a variable. Something like:
$jmespath(list, `[?json.Name == ${vname}]`);
Where vname is my variable.
I read that you have to use literals. So thats what I tried, but still not working.

What is the error message (if any)?

No error message, just not taking the variable as filter.

Please share the workflow

Share the output returned by the last node

Information on your n8n setup

  • n8n version: n8n 1.7.0 for Windows
  • Database you’re using (default: SQLite):
  • Running n8n with the execution process [own(default), main]:
  • Running n8n via [Docker, npm,, desktop app]:

Quotes are missing. With, it will work as expected:

var list = $input.all();
var vname = "Ingrid";
var shortlist = $jmespath(list, `[?json.Name == '${vname}']`);
return shortlist;

Great! Thanks for the hint.

You are welcome, have fun!

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.