JMEPath doesn't return correctly

A picture speak more than 1000 words :slight_smile:
I have my source as array of objects (left), i tried to use [*].DeptCode to only pull department code but nothing return (right)

But under JMePath tutorial, i can easily pull them out. Hence it’s not my script error, is it a bug in n8n?

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

@weilies_chok , the problem is not with JMEPath but rather with how you handle $input. You need to bear in mind how n8n passes the data between the nodes (see Data structure | n8n Docs).

To fix it, use this expression:

$jmespath($input.all().map(i => i.json), "[*].DeptCode")
3 Likes

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