Igor_Bozhinovsk
3 years agoNew Contributor III
Map Json Structure
Currently we have json data like this :
{
“Test”: “1”
“SerialNumbers”: {
“SerialNo”: [
“123”,
“456”
]
}
The desired output is like this:
{
“Test”: “1”
“SerialNumbers”: [
{“SerialNo”: “123”},
{“SerialNo”: “456”}
]
}
Is there any function we could use to achive this in SnapLogic ?
You might be able to get around it by using the following expression in a mapper before trying to process the $messages value:
sl.ensureArray($messages)
This way, if it is a single object, it will be a single-entry array. If it is already an arrary, it simply passes through.