I am joining an API JSON that has multiples items into single item following the documentation: JavaScript Code Snippets | Docs
But I see in this case I have an issue, the API gets wrapped in Square brackets in which the system that I am importing does not accept wrapping square brackets.
Ideally should be only without wrapping “[]”
"["
{
data_object: [
{
"id": 1,
"name": "Jim"
},
{
"id": 2,
"name": "Stefan"
},
{
"id": 3,
"name": "Hans"
}
]
}
"]"
My results:
[{“records”:[{“id”:“recvwZHRICpLaVf97”,“fields”:{"…}]
What I should get:
{“records”:[{“id”:“recvwZHRICpLaVf97”,“fields”:{"…}
Is this possible? If I need to share flow, let me know how I can share privately. Thank you very much.
Are you referring to the [] in the JSON view? That represents the different items that flow through the workflow. You can ignore those.
If you really get a wrong result, a workflow is only helpful if we can execute it and get the same data you receive.
Hi @jan,
How to ignore those since they also result from the API call? If I run these results via webhook, I get the [], if I run via another API provider (as I had originally) by default it has no []. Thanks.
What I was saying is that if you use the JSON view and it looks like this:
Then the data of that one item is actually just:

Hi @jan,
I fixed it now differently, but if you mean inside the data_object correct, but when data is displayed as a single item, the are wrapping the single item array, I can show you two different endpoints and n8n gives different output than when I ran the other API.
n8n webhook

Different API builder provider

I am pulling this data into a website (php), I was able to fix just now by calling via “$data[0]” for n8n endpoint while originally (for the other provider) I used only $data.
I can share in private (sensitive data) the 2 different endpoints just for the curiosity of it, you will see what I mean
.
Thanks for the help though
, much appreciated.