03-08-2022 06:02 PM
Hi,
I have a nested json, with the inner most element is an array of struct.
The key to identify this inner element is a dyamic value. see the numeric value in the below json.
the json parser snap works fine with this, but when it comes to splitter, I am not able to give the actual value to split on. has anyone worked had success with a json like this ?
{
“VehicleName”: “Test Automobile”,
“VehicleId”: 0000011111,
“renderedDate”: “2022-03-02”,
“alternativeVehicle”:
{
“0000002222”:
[
{
“priority”: “1”,
“VehiclelabelName”: “Car 1”,
“VIN”: 72183,
“type”: “Manual”
},
{
“priority”: “2”,
“VehiclelabelName”: “Van 1”,
“VIN”: 72166,
“type”: “Auto”
}
],
“00002144509”:
[ {
“priority”: “1”,
“VehiclelabelName”: “miniVan 1”,
“VIN”: 72432,
“type”: “Auto”
}
]
}
}
03-08-2022 09:53 PM
@Bobby try below expression in mapper and name vehicleList in target mapper. Then use json splitter. PFB screenshot.
$alternativeVehicle.mapValues((val,key) => val.map(ele=> ele.extend({“vehicleKey”:key}))).values()