You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Obviously I have to do nested for loop here (unless Im missing something) but the only way I can do nested loop is by declaring an new array for each for and then do flattening of all nested arrays to become one:
Why I cant do direct nested of for loop as follows:
{
"ids":[for(.root)
for(.)
for(.value) .id ]
}
I tried to use Pipe operator as well , and it did not work. It always complain about two consecutive for statement. Can this be an enchantment to save overhead , get better performance and make the code more readable or this can cause other issues ?
Thanks
The text was updated successfully, but these errors were encountered:
Hi,
Sometimes I find myself traversing different level arrays where Im interested at certain array level data. let's say we have the following json:
If I want to bucket all id values into an array in new json as follows:
Obviously I have to do nested for loop here (unless Im missing something) but the only way I can do nested loop is by declaring an new array for each for and then do flattening of all nested arrays to become one:
Why I cant do direct nested of for loop as follows:
I tried to use Pipe operator as well , and it did not work. It always complain about two consecutive for statement. Can this be an enchantment to save overhead , get better performance and make the code more readable or this can cause other issues ?
Thanks
The text was updated successfully, but these errors were encountered: