"Item Lists" fails with error "Couldn't find the field (value of key being filtered) in the input data"

Describe the issue/error/question

Hey everyone, I’m trying to build my first workflow, but I’m running into a weird problem.

I have some JSON data coming in from a webhook. I am then trying to filter out some data from the JSON using the “Item Lists” action. I have dragged-and-dropped the required key from the JSON into the “Field to Split Out” field.

What is the error message (if any)?

When I execute the action, the data seems to be correctly filtered out at first, but the action then immediately errors out with “Couldn’t find the field (filtered out data here) in the input data.” The weird thing is, the filtered data (in this case the string “Check check, 1, 2, 3. Are we coming in clear?”) is included in the error message as if the filtered data itself was the name of the JSON key I’m trying to filter out. The resulting error message is “ERROR: Couldn’t find the field ‘Check check, 1, 2, 3. Are we coming in clear?’ in the input data.”

Have a look at this screenshot of the result:

The incoming JSON data looks like this:

[
   {
      "headers":{
         "connection":"close",
         "host":"(URL of my server)",
         "x-forwarded-scheme":"https",
         "x-forwarded-proto":"https",
         "x-forwarded-for":"(my IP)",
         "x-real-ip":"(my IP)",
         "content-length":"218",
         "accept":"application/json, text/plain, */*",
         "content-type":"application/json",
         "user-agent":"axios/0.27.2"
      },
      "params":{
         
      },
      "query":{
         
      },
      "body":{
         "notification_type":"TEST_NOTIFICATION",
         "event":"",
         "subject":"Test Notification",
         "message":"Check check, 1, 2, 3. Are we coming in clear?",
         "image":"",
         "media":null,
         "request":null,
         "issue":null,
         "comment":null,
         "extra":[
            
         ]
      }
   }
]

I’m trying to get the string from the key “body” → “message”, so I’m expecting the result to be the string “Check check, 1, 2, 3. Are we coming in clear?”

What am I doing wrong?

Thank you very much for any answers

Please share the workflow

Share the output returned by the last node

The full error is:

NodeOperationError: Couldn't find the field 'Check check, 1, 2, 3. Are we coming in clear?' in the input data
    at Object.execute (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/ItemLists/ItemLists.node.js:792:35)
    at Workflow.runNode (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/Workflow.js:659:51)
    at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/WorkflowExecute.js:585:68
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

Information on your n8n setup

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

Welcome to the community @buresdv !

Think there is a misunderstanding. The parameter expects the name of the field not it’s value. So to 95% of the time that would be not set to an expression. In your case the value you want is probably “body.message”

Hey Jan, thank you very much for the quick response!

I think I’m missing something basic :sweat_smile:. I’ve tried putting in body.mesage into the “Field to Split Out” field, which I’ve changed to “Fixed” instead of “Expression”. Now I’m getting a different error:

ERROR: The provided field 'body.message' is not an array
NodeOperationError: The provided field 'body.message' is not an array
    at Object.execute (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/ItemLists/ItemLists.node.js:796:31)
    at Workflow.runNode (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/Workflow.js:659:51)
    at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/WorkflowExecute.js:585:68
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

Ah sorry, did not read everything super deeply as I just saw that you did use the node wrong. But it looks like you are also using the wrong node. That option on the node is for splitting out data from an array into separate items. That is why it complains that it is not an array. What you however seem to want to do, is to get out one value and throw away everything else. In this case, it is probably easiest to use the Set-Node, define the values you want to keep, and activate “Keep Only Set”.

1 Like

Oh yeah, that’s it! Thank you very much for telling me about the “Set” action, that is exactly what I needed. I was using the “Item Lists” action because it was the first result that showed up when I googled “n8n get value from JSON”.

Yes is def. not easy in the beginning to know which node to use for what. There is for sure a learning curve and we have to find better ways to surface the right nodes to the users.

Great to hear that it helped. Have fun!

1 Like

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