I'm struggling with this for several days. This is the answer I get (with anonymous data). I want to retrieve the first "channel_definitions[2]" by checking this data :
When the channel_definitions is an array of 2 then :
- the name is "Maddy's life ***********" for the mode "THE FIRST MODE" (please note there is a " ' " in the name)
- the name is " *********** computer" for the mode "THE SECOND MODE"
[
{
"id": "82",
"channel_definitions": [
{
"id": "8200",
"mode": "THE FIRST MODE",
"types": [
"VALUE",
"HOME"
],
"interactive": true,
"name": "Maddy's life ***********",
},
{
"id": "8201",
"mode": "THE SECOND MODE",
"types": [
"BOOKING",
"CREDIT"
],
"name": " *********** computer"
}
]
},
{ "id": "10002", "channel_definitions": [ { "id": "1000201", "mode": "THE SECOND MODE", "types": [ "BOOKING", "CREDIT" ], "name": " *********** computer" } ] }, { "id": "88", "channel_definitions": [ { "id": "8800", "mode": "THE FIRST MODE", "types": [ "BOOKING", "VALUE", "HOME", "CREDIT" ], "name": "piano §§§§§§§§§§" } ] }, { "id": "149", "channel_definitions": [ { "id": "14900", "mode": "THE FIRST MODE", "types": [ "VALUE" ], "name": "+++++ paraglading ++++++++++++++" } ] }, ]
I have done the 2 others parts.
I tried everything I thought can works and I read on the Internet but not the correct one. For instance deals with these ideas
- def listOfChannelDef = karate.jsonPath(response, "$..channel_definitions== '#[2]'")
- def listOfChannelDef = karate.jsonPath(response, "$..channel_definitions[2]")
Please if you know how to do it or has any idea of how to do it let me know.
Alicya