I'm having a json with input:
{
"customerId": "12345",
"customerStatusTrail": [
"INITIATED",
"PENDING",
"COMPLETED"
],
"segment": "S1"
}
which I want to convert it to:
{
"customerId": "12345",
"customerStatusTrail": "COMPLETED",
"segment": "S1"
}
The list of customerStatusTrail would not always be of size 3. It would always be different. I want to fetch the last element of list and use that in the output.
I'm not sure if there is facility in JOLT for such transformation to fetch the last element of list.