Awesome tip, @GetUWired! Thanks for sharing :)
Not working on my side !?
First step not working, here’s details with images….
Blue (array of 2 items) should match the blue and red match the red each color associated with it’s right color….. 1. Line Items Meta Data Display value isn’t kept separated… it is merged as like it was the same array red + blue from the first image...
Here’s the inputs

Here’s the output !!!

What’s wrong, the initial array are not kept ?
Hi @GandalfG
Can you share screenshots of the json as it appears from your trigger step?
My first guess would be that iListAtts and iListsAttsSelects are not nested arrays like you’ve built your json but rather an object with two arrays in it. Thus, i would remove the extra square brackets surrounding them.
@GetUWired Thanks for sharing – however I can’t seem to recreate your setup.
Particularly, I am having trouble recreating the setup required to return “[10, 15], null”.
When I have nested line items, the nulls are ignored entirely.
e.g. I create a sample return in a Code by Zapier box:
output = {result: [
{id: 123, hello: "world", sub: [{id:1, name:"bob"}] },
{id: 124, hello: "world2", sub: [{id:2, name:"bob2"},{id:3, name:"bob3"}] },
{id: 125, hello: "world3", sub: null},
]};
In subsequent steps, the input choices look like this:

So, how did you manage to get the array [10,15],null to appear? If I can’t even get it when feeding it the JSON directly via a JS code block, then what else can I try? Without the array brackets showing up, the formatter can’t decipher what should be in an array/object as opposed to just a comma-separated list.
In the end, I am looking to be able to process sub- Line Items, i.e. provide a list of items, each one of which has one or more fields that are arrays of foreign key ids.
thanks
Stephen
@StephenB
Unfortunately, we have come to find out this solution does not work with complex nested arrays.
The structure of your data is an array with many objects that all have their own arrays with nested objects.
Our solution ideally works best on line items with only a nested object structure. and works okay for simple text or number arrays in those object but does not work well for arrays that have nested arrays with their own object structures.
ie…
[
{
"id": 1,
"name": "test1"
},
{
"id": 2,
"name": "test2"
}
]
it will rebuild no problem. and we’ve come to find it should handle situations like this
[
{
"id": 1,
"name": "shirt",
"qtys": [1,2],
"sizes": ["Large","x-large"]
},
{
"id": 2,
"name": "some other item",
"qtys": [1],
}
]
but it cannot handle these types of situations in which you are trying to rebuild an array with objects nested within another array:
[
{id: 123, hello: "world", sub: [{id:1, name:"bob"}] },
{id: 124, hello: "world2", sub: [{id:2, name:"bob2"},{id:3, name:"bob3"}] },
{id: 125, hello: "world3", sub: null},
]
If you need to rebuild nested arrays like these we suggest using a POST Webhook action with passthrough enabled (immediately after the step you are trying to rebuild) to a second Zap that triggers by the Catch RAW Webhook trigger. You can then use a code block (in the second zap) to manipulate the raw json results however you’d like.
Thanks @GetUWired that’s really helpful. There seems to be all kinds of idiosyncrasies with this…
Cheers
Stephen
@GetUWired Is my data structure shown below one that could only be handled by the raw webhook as you described?
