How to use variable in code node

Hi I’m a beginner with n8n and javascript. I’m trying to put variable from previous node in the code node.

  1. I tried pasting parameter path and item path.
  2. tried removing their curly braces, and encapsulating them in list.
  • nothing works. some errors I’m getting are output. Item didn’t returned properly and position error.

I’m pretty confused how to use variables in here. I tried same code with other IDE’s they run perfectly.

My usecase is to strip some part from my input. I have the code for it, but just help me use variables in code node and also guide me if there’s anything else I need to know to code 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:

@Jennifer_Madison , to address data in your input (which is a single item), you can use the following reference, $input.first().json.body.data. You can read more about it in Current node input.

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