How Can I Eliminate a JSON Wrapper Key in N8N Output?

In N8N, I need to strip away an extra JSON key so my output returns a simple array. How can I reformat my workflow?

function convertResult(rawInput) {
  return rawInput.elements;
}

hey, try destructuring: function convertResult({elements}) { return elements; } works fine in n8n for me. lmk if it fixes ur issue.

Based on my experience, streamlining the JSON output in n8n can be achieved by ensuring that the function properly extracts the needed property without additional wrapping. One method I used was to validate the structure of the JSON and directly return the object property that holds the array. This approach avoids unexpected nested data issues upon further processing, especially when combining results from multiple nodes. In testing, isolating the exact element to be returned made downstream handling simpler and added clarity to workflow logic. This method has significantly reduced debugging time and improved overall workflow reliability.