Reputation: 91
I'm trying to join (comma separated) a nested array but cannot achieve it.
Input:
{
"PARTS" : [ [ "aaaa", "bbbb" ], [ "cccc", "dddd" ] ]
}
Desired output:
{
"PARTS": [ "aaaa,bbbb", "cccc,dddd" ]
}
I am trying to use =join
but yet unsuccessful. Any help is appreciated.
Thanks!
Upvotes: 1
Views: 77
Reputation: 61
I managed to get the output you were aiming for :)
[
{
"operation": "modify-overwrite-beta",
"spec": {
"PARTS": {
"*": "=join(', ',@0)"
}
}
}
]
The trick here is using @0
, which points to the 0-th element on the hierarchy you're working with. At least, that's what the documentation says.
Upvotes: 1