Forum Discussion
CoreBit
New Contributor
Hi,
I have got the same issue with property expansion inside JSONPath:
I have a custom property "Property_Name" with value "Property_Value" in the TestSuite.
Inside a transfer step I want to use it like this:
$.response.data[?(@.label=='${#TestSuite#Property_Name}')]
It does not work, result is [[]].
But when I specify the value like in the following expression, then I get my desired result:
$.response.data[?(@.label=='Property_Value')]
Is property expansion inside JSONPath not possible at all or am I doing it wrong?
Regards,
Adam
nmrao
9 years agoChampion Level 3
Is it possible for you to post the raw response?
- CoreBit9 years agoNew Contributor
Hi Rao,
the response looks like this (shortened):
{ "response" : { "endRow" : 300, "totalRows" : 21938, "status" : 0, "startRow" : 0, "data" : [{ "label" : "Property_Value", "lastUpdateDate" : "2014-08-13T15:48:56" }, { "label" : "Property_Value2", "lastUpdateDate" : "2014-08-13T15:48:58" }, { "label" : "Property_Value3", "lastUpdateDate" : "2014-08-13T15:49:01" } ] } }
Regards,
Adam
- nmrao9 years agoChampion Level 3Thank you for the info. Here there are 3 labels (arraylist) which one's value you want to compare against Test suite's property? or to be matched with any one of the three(not any particular label)?
- CoreBit9 years agoNew Contributor
Hi Rao,
for instance, I would like to access the lastUpdateDate field like this:
$.response.data[?(@.label=='${#TestSuite#Property_Name}')].lastUpdateDate
But this does not work, I get the followin error message:
Thu Dec 10 14:11:04 CET 2015 lastUpdateDate [Array index [Ljava.lang.String;@1d2eca2 not found in path]
Though this works:
$.response.data[?(@.label=='Property_Value')].lastUpdateDate
EDIT:
Result in latter case will be:
[2014-08-13T15:48:56]
Any idea?
Regards,
Adam
Related Content
- 5 years ago
- 6 years ago
- 2 years ago