struggling a bit to do that I want, perhaps you may help me. I have a dynamic output object with different amount of items and I don't know name of keys, so I just do output like this:
%dw 1.0
%Output application/json skipNullOn = "everywhere"
---
flowVars.OutputListArr orderBy $$
this work fine for payload like:
ccc="333", bbb="222", aaa="111", ddd="444"
but now I have situation then one of keys is a list, but I want to return it as array, e.g.
bbb = "221,222,223"
I can do it by
splitBy "," ->> "['221', '222', '223']"
but don't know how to do it together. So then input will be like that:
{ccc="333",bbb="221,222,223",aaa="111", ddd="441, 442, 443"}
I want to transform it into that:
"aaa": "111",
"bbb": ["221","222","223"],
"ccc": "333"
"ddd": "441, 442, 443",
so only bbb string get splitted (I know bbb key name)
upd: just get a situation then bbb may have only one member, so expecting a way to check key attribute name and then make it array ish... so dont belong on content it self