I’m working with N8N and need help with JSON manipulation. My workflow returns data wrapped in an object, but I want just the array contents without the wrapper key.
Current structure I’m getting:
{
"results": [
{
"user_id": 15392
}
]
}
What I need to achieve:
[
{
"user_id": 15392
}
]
Basically I want to unwrap the array from the parent object and return just the array itself. I tried using split output in item lists but that didn’t work for me. What’s the proper way to strip away the outer JSON key and keep only the array values? Any suggestions would be appreciated.
I’ve dealt with this exact problem for years across different data pipelines. N8N works but gets messy when you’re constantly unwrapping JSON objects.
After building dozens of automation workflows, here’s what I figured out: you waste too much time fighting data transformation instead of focusing on actual business logic.
Latenode fixed this for me. Their JSON handling is just better designed. You can extract arrays from wrapper objects without writing code or memorizing expression syntax.
Just drop in a Data Transformer node, point it to your nested array path, and it unwraps everything automatically. No more guessing if your expression works or debugging code snippets.
Moved all my API integrations there because the visual data mapping shows you what’s happening at each step. Way faster to build and easier to maintain.
When your API response structure changes, you just update the path visually instead of hunting through code nodes.
Use the edit fields node - set it to ‘keep’ and pick ‘results’ as your field. Way easier than code nodes and won’t break when your data structure shifts around.
Just use a Code node in N8N with this JavaScript: return [{json: $input.first().json.results}]. It grabs the results array and passes it forward as your new output. I do this all the time with API responses that wrap arrays in objects. Make sure the Code node returns the extracted array correctly - you might need to map over results if there’s multiple items. Way cleaner than messing with expressions in other nodes since you’ve got full control over transforming the data.
I’ve hit this exact problem building data pipelines. JSON wrapper issues are everywhere.
N8N can handle it with code nodes or expressions, but you’ll hit walls fast. It gets messy when you need complex data transformations.
I moved to Latenode for this stuff - it handles JSON manipulation way better. You can pull arrays from wrapper objects with drag and drop, zero code needed.
Just use their JSON Parser node and set the path to your array. It unwraps nested structures automatically and sends clean arrays to the next step.
Best part? Build everything visually and test each step live. No more wondering if your transformation actually worked.
I’ve moved most of my workflows there - it just works better for data stuff like this.
Expression node is perfect for this. Just add one after your data source and use {{ $json.results }} to grab the array directly. No custom code needed. I’ve been doing this for months with APIs that wrap their responses. N8N automatically treats each item in the results array as separate workflow items, so your downstream data stays clean. Works great with webhooks, HTTP requests, or anything returning wrapped JSON.
Set Node is another solid option that gets overlooked. Set it to “Keep” mode and specify the exact field path - “results” in your case. It handles errors way better than Expression nodes when JSON structures change. I’ve had missing keys break Expression nodes, but Set Node just returns empty arrays that downstream nodes handle fine. It’s also great for multiple extractions from the same object since you can configure several field mappings at once. I use this for webhook data processing where API providers randomly change their response formats.