I have a JSON input:
{
abc: "",
def: "hello"
}
I want to make this blank element as nillable in XML i.e. . I am using the below dataweave code:
%dw 2,0
output application/xml skipNullOn="everywhere"
var makeNil= (in) ->
in match {
case is Array -> in map makeNil($)
case is Object -> in mapObject (
if ( ($) == "")
($$) @(xsi#'nil':true): {}
else ($$): makeNil($)
)
else -> in
}
---
makeNil(payload)
I am not able to create an attribute using @(xsi#'nil':true) for key($$). Please help me