Hi,
I have an array of values and from that Array(which might have more than one value) I always want to choose the last value. How to do it
Example:
In the below JSON I want to select the Last array of id value
check(jsonpath(“$.data.A.main[].attempts[].id”).findAll.saveAs(“id”))
As this array is not static so I want to choose the last value of the array always.
sample JSON
{
"data": {
"A": {
"A1": {
"colour": "1",
},
"main": [
{
"Type": "1",
"attempts": [
{
"id": "Abc1"
}
]
},
{
"Type": "2",
"attempts": [
{
"id": "def27"
}
]
},
{
"Type": "3",
"attempts": [
{
"id": "rtyw12"
}
]
},
{
"Type": "4",
"attempts": [
{
"id": "98dg"
}
]
}
]
}
}
}
–A