Questions tagged [gpath]

Path expression language integrated into Groovy which allows parts of nested structured data to be identified. Can be used to query XML and nested Plain Old Java Objects

An overview of GPath with some sample code can be found on the codehause.org site

http://groovy.codehaus.org/GPath

79 questions
1
vote
1 answer

Escape dots in Groovy GPath

I am using the RestAssured framework in Java, whose documentation contains this note Note that the "json path" syntax uses Groovy's GPath notation and is not to be confused with Jayway's JsonPath syntax. I need to validate the following…
Vlad.Bachurin
  • 1,340
  • 1
  • 14
  • 22
1
vote
1 answer

Rest assured path not able to access element with number in path

In the following (partial)JSON response: { "costPrices": { "3226186": [ { "fromDate": 1420066800000, "toDate": null, "product": { I'm trying to access the value of fromDate like this:…
sjottil
  • 43
  • 6
1
vote
2 answers

gpath accessing data from objects with identical names

I am using gpath to parse xml. I want to pull the pass/fail values from the stat object. The problem I have had is that the objects are being grouped together. I cannot access them separately. This is the data I am working…
Drew Royster
  • 120
  • 12
1
vote
2 answers

Groovy GPath find nodes by many conditions

Suppose having XML:
lospejos
  • 1,976
  • 3
  • 19
  • 35
1
vote
1 answer
1
vote
1 answer

Groovy GPath with variable in it

with the XML code below: def soapResponse = " 144107 TESTING QA
user1599401
  • 65
  • 1
  • 2
  • 10
1
vote
1 answer

Rest-assured looking up object from Unnamed Root

I am relatively new to Rest-assured and Gpath. From the JSON below, I just want to get a map with the keys / values for 'RideA' [{ "state": "open", "name": "RideA", "imageCount": 2 }, { "state": "open", "name": "RideB", "imageCount": 1 …
JamesWillett
  • 980
  • 2
  • 8
  • 20
1
vote
1 answer

Gpath when an expression is true

From the JSON below, I am trying to write a Gpath that will only return the "state" field when the "type" field is equal to ride_state (i.e. I just want the two "open" states) [{ "type": "day", "data": { "id":…
JamesWillett
  • 980
  • 2
  • 8
  • 20
1
vote
2 answers

How to find an object by a field value in Rest Assured?

I need to get to code of an array element that has field == firstName: { "errors": [ { "field": "firstName", "code": "NotBlank" }, { "field": "lastName", "code": "NotBlank" …
Elnur Abdurrakhimov
  • 44,533
  • 10
  • 148
  • 133
1
vote
1 answer

Map from XML using rest-assured

I'm trying to set up an integration test using rest-assured. In one of my test cases I have to validate some properties of an XML file with rest-assured's XmlPath which seems to use Groovy's GPath. I have an XML document with the following…
Sandra
  • 3,560
  • 5
  • 24
  • 31
1
vote
2 answers

Finding xml element value case insensitive using XmlSlurper/GPath?

I am parsing a piece of XML using XmlSlurper and need to find an xml elements value. The challenge in this is that i am not always sure if the casing in the xml document will be correct, so i need to find the element in any possible…
Marco
  • 15,101
  • 33
  • 107
  • 174
0
votes
4 answers

Find the text of an element in XML that contains a namespace with GPath

Hey I would like to find a given text in an xml that looks like this:
Nyegaard
  • 1,309
  • 3
  • 16
  • 24
0
votes
1 answer

How do I match items in a list from an anonymous root from a RestAssured body?

I have this output [ {"name": "a"}, {"name": "b"} ] And the following code given() .get("endpoint") .then() .body("$.name", hasItem("b")); But I get this result java.lang.AssertionError: 1 expectation failed. JSON path $.name doesn't…
mdong
  • 345
  • 3
  • 10
0
votes
2 answers

Gpath for JSON with nested findAll

I have the following response payload [{ "id": 1, "catname": "Cat01", "items": [{ "Name": "Item01", "id": 2 }, { "Name": "Item02", "id": 3 }] }, { "id": 4, "catname": "Cat02", "items":…
Txili
  • 17
  • 3