Forum Discussion

nkasemsan's avatar
nkasemsan
Occasional Contributor
7 years ago
Solved

jsonpathRetrieve array element in an array from JSON response

Hi All,   I'm trying to retrieve an array element within an array (sample response attached) from a test step in a test case.   Within this response, I want to retrieve an array of Telecoms values ...
  • PaulMS's avatar
    7 years ago

    The result of JSONPath expression $..Telecoms[?(@.SystemCode=='phone')].ValueString has more than 25 elements because there are different use codes.  Do you want to filter only mobile or home phone numbers?

     

    $..Telecoms[?(@.SystemCode=='phone') && @.UseCode=='mobile')].ValueString

     

    If the use code for the first element doesn't matter then

    $..Telecoms[?(@.SystemCode=='phone')][0].ValueString