Karate : Is there a way yo get a specific value as a string instead of an array when using jsonPath
My Requirement is i'm trying to get a specific value from the response and trying to assign it to another variable using jsonPath. but the value is being stored as an array value. Instead i need that value to be stores as a String so that i can use it in next request as a query param
{
"firstName": "John",
"lastName": "doe",
"age": 26,
"address": {
"streetAddress": "naist street",
"city": "Nara",
"postalCode": "630-0192"
},
"phoneNumbers": [
{
"type": "iPhone",
"number": "0123-4567-8888"
},
{
"type": "home",
"number": "0123-4567-8910"
}
]}
using following jsonPath --$.[?(@.type == 'home')].number i'm getting ["0123-4567-8910"]. But what i need is to store only the number(0123-4567-8910) directly.