Find a node by name in RestAssured JPath

426 Views Asked by At

I got the following JSON

   {
   "response":{
      "id":"XYZ",
      "header":[
         {
            "nat":"1"
         }
      ],
      "summary":[
         {
            "recordCreationDate":"29-Aug-2018",
            "verificationTypeDescription":"Verified",
            "birthDate":"01-Feb-1981",
            "sex":"F",
            "title":"MRS",
            "forename":"TEST",
            "surname":"TEST"
         }
      ]
   }
}

and I would like to get the value of any field, for instance birthDate, without providing the full path. Reading this nice tutorial https://www.james-willett.com/rest-assured-gpath-json, I have manage to write this - NOT WORKING - code:

response.jsonPath().get("$.'**'.find(){node -> node.name() == 'birthDate'}");

What am I missing?

0

There are 0 best solutions below