Forum Discussion
AmitA
11 years agoOccasional Contributor
Hi Team
In Xpath I am using 'count' to count the nodes like in the below example I am counting number of HotelStay.Please tell me how to count the same in jsonpath.I want to count the CancellationPolicies given below
Xpath:
def UAPIResultCount = context.expand( '${#TestCase#UAPIXML#declare namespace ns1=\'UniversalAirAPI\';count(//OTA_HotelAvailRS[1]/HotelStays[1]/HotelStay)}' )
Json path:
def Cancellationpolicy = context.expand( '${BlockRoomFixedBE#Response#$.BlockRoomResult.HotelRoomsDetails[0].CancellationPolicies[1]}' )
In Xpath I am using 'count' to count the nodes like in the below example I am counting number of HotelStay.Please tell me how to count the same in jsonpath.I want to count the CancellationPolicies given below
Xpath:
def UAPIResultCount = context.expand( '${#TestCase#UAPIXML#declare namespace ns1=\'UniversalAirAPI\';count(//OTA_HotelAvailRS[1]/HotelStays[1]/HotelStay)}' )
Json path:
def Cancellationpolicy = context.expand( '${BlockRoomFixedBE#Response#$.BlockRoomResult.HotelRoomsDetails[0].CancellationPolicies[1]}' )