I have a json payload with the following format:
{"key":"value",
"key:1":"value",
"key:2","value",
"junk key":"value",
"part":"value",
"part:1","value",
"part:2","value"...}
and want to transform it to:
{"1":{
"key":"value",
"part":"value"
},
"2": {
"key":"value",
"part":"value"
},
"3": {
"key":"value",
"part":"value"
}
}
Any thoughts?
Here is the closet output I could get using Dataweave, just the formatting of removing additional curly braces could be done in the subsequent message processor using MEL or simple java code. Hope it helps!!
Input JSON {
"key":"value1", "key:1":"value2", "key:2":"value3", "junk key":"value4", "part":"value5", "part:1":"value6", "part:2":"value7" }
Dataweave Logic:
Result