Set Node outputting something different than what the JSON previews the output should be

I’m having trouble with this one Set node where it’s outputting something different than what the preview is showing me. Not sure if this is a bug or if I’m doing something wrong. Can anybody take a look and let me know?

Hi, @maud97
Just I recommend you to post such questions under “Question Category” so, the members will find the problem soon,
you posted using “tips” subcategory, anyway I’ll take a look

Try the following;

const parserOutput = $input.all()[0].json;  // get all items from Lllama Parser
return parserOutput.map(item => ({
  json: {
    job_id: item.id,
    fileName: item.fileName
  }
}));
  • This ensures all items are mapped correctly.
  • Set Node sometimes fails when multiple items are involved or expressions point to missing fields.

you can use:

// Get all items from previous node (Lllama Parser)
const items = $input.all();

// Map over each item to generate job_id
return items.map(item => ({
  json: {
    job_id: item.json.id,       // adjust path if 'id' is nested
    fileName: item.json.fileName // optional
  }
}));