โ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()