vonkendu
2 years agoNew Contributor II
Problem with nested mappings
Hi guys! I am quite new to SnapLogic and I am having a bit of a struggle with transformations. I worked with Mulesoft previously, and honestly, I am kinda trying to do things the same way but it doesn't really work here.
So this is my incoming JSON (it is quite ugly, I know):
{
"ID": "1234",
"Name": [
"Michael"
],
"parameters": [
[
[
{
"parameterOne": 1000,
"parameterTwo": 1200
}
],
[
{
"parameterOne": 20000,
"parameterTwo": 20000
}
],
[
{
"parameterOne": 10,
"parameterTwo": 1000
}
]
]
]
}
Main issue is the nested array (that Im not sure how to remove).
The result needs to look like this:
[{
"ID": "1234",
"Name": "Michael",
"parameterOne" : 21010
"parameterTwo" " 22200
}]
Name is always going to be 1 element in array, so it needs to be flattened.
As for parameterOne and parameterTwo - I need to add up all the values from the inner nested arrays and than also flatten them and put them into a result.
Any tip would be appreciated
Thank you!