Reputation: 337
I am using JSON path extractor with Jmeter.
I need to extract 36735928 or 37851136 which is inside CURRENT. Tried with but no success.
$.payload.reservationLists.CURRENT.[0]
Any suggestion of how to get those values. I don't want to use Regular expression extractor. Is it possible to get the value of the below JSON.
JSON response as below
{
"payload": {
"userName": {
"firstName": "Peter",
"lastName": "Pan"
},
"reservationLists": {
"CURRENT": {
"36735928": {
"startDate": "2013-10-03",
"destination": "Balearen",
"mainProductType": "Mietwagen",
"allProductTypes": [
"Mietwagen"
]
},
"37851136": {
"startDate": "2013-10-14",
"destination": "Nevada, Las Vegas",
"mainProductType": "Camper",
"allProductTypes": [
"Extra",
"Extra"
]
}
}
"PAST": {
"12061210": {
"startDate": "2012-05-05",
"destination": "Loire / Nivernais",
"mainProductType": "Boot",
"allProductTypes": [
"Boot",
"Extra"
]
}
}
}
}
}
Upvotes: 1
Views: 2133
Reputation: 510
NOTE: the json posted is broken, it is (at least) missing the last } if the "PAST" element is really to be placed inside the "CURRENT" element
That said, the question is not really clear: you could get the element you want by index with the following expression:
$.payload.reservationLists.CURRENT[36735928]
if you know the name of the element you are trying to retrieve. If this is not what you meant, could you please elaborate on that?
Thank you, bye
Upvotes: 1