We are running MuleEsb 3.9.0 I'm trying to remove empty array's in my dataweave transformation. For example:
payload map ((value , indexOfValue) -> {
value : {
content: value.content,
subvalue: value.subValue map ((subValue, indexOfsubValue)->
{
sub: subValue
}) filter ($.sub != null )
}
})
this will result in
[
{
value:
{
content: xyz
subValue: []
}
}
]
i want subValue to be totally removed. to be outputted:
[
{
value:
{
content: xyz
}
}
]
You need something like this:
payload map ((v) -> {
value: {
content: v.content,
(subvalue: v.subValue map ... ) when ((sizeOf v.subValue) != 0)
}
})
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.