Forum Discussion
HKosova
Alumni
9 years agoYou need to prefix the property name with the corresponding scope, such as ${#Project#EmployeeId} if it's a project property or ${#TestCase#EmployeeId} if it's a test case property.
Sriraj
9 years agoContributor
HKosova Right. i was concentrating on the problem statement thus did not add the testcase name etc..
- HKosova9 years ago
Alumni
Given the exact JSON
{ "Name": "ABC", "Item_Id": "<EmployeeId>", "Status_Id": "Received", "Points": 5 }your JSONPath should work fine, provided that the property name, scope and value are correct:
[?(@.Item_Id=='${#TestCase#EmployeeId}')].Status_IdIf the object you are testing is nested inside another object, such as:
{ "something": { "Name": "ABC", "Item_Id": "<EmployeeId>", "Status_Id": "Received", "Points": 5 } }you need to specify the path from the root object, e.g.:
$..[?(@.Item_Id=='${#TestCase#EmployeeId}')].Status_IdIf you post the exact JSON, we could give a more precise answer.