Questions tagged [rest-assured-jsonpath]

For use only with the popular REST-Assured API testing framework for Java.

Path-based query syntax for JSON documents in the REST-Assured framework for API testing. Not to be confused with the JsonPath specification (http://goessner.net/articles/JsonPath/)

Docs: https://github.com/rest-assured/rest-assured/wiki/Usage#json-using-jsonpath

382 questions
0
votes
1 answer

Using JsonPath in Java (8) to create/add nodes and arrays

I am trying to create or update a JSON with a new key:value nodes inside a JsonArray. So far I am able to add simple values using a map of nodes, but I am unable to add an array. The goal is to create a JSON string with the following values: { …
Leon Proskurov
  • 135
  • 1
  • 14
0
votes
1 answer

I am unable to post an Add Place API when using POST http method

io.restassured.path.json.exception.JsonPathException: Failed to parse the JSON document It is throwing error in the code written for these Feature file steps: Given Add new location with "" "" "
" parameters Then …
0
votes
1 answer

Extract REST API request json value to variable in RestAssured

We have to validate the value sent in our REST API request payload with Response value, Tried the below and was able to get the JSON array printed. How to get the specific object inside the array of the request JSON body. Request Payload : { …
la1
  • 519
  • 1
  • 8
  • 30
0
votes
1 answer

java.lang.ClassCastException: com.google.gson.internal.LinkedTreeMap cannot be cast to pojo.class

Getting java.lang.ClassCastException: com.google.gson.internal.LinkedTreeMap cannot be cast to pojo.class while serializing Generic type.Kindly assist. This is the code written for Json fileReader class. public class ReadJsonFile { private…
TestQA
  • 69
  • 6
0
votes
1 answer

How to extract and display the preference node from the below JSON

JSON: [ { "name": "TEST", "desc": "", "descData": null, "closed": false, "idOrganization": null, "idEnterprise": null, "limits": null, "pinned": null, "shortLink": "0vww", …
JACOB SAMUEL
  • 3
  • 1
  • 4
0
votes
0 answers

RestAssured: Assert Json response which has single object response fails due to not started with curly brace '{' or an openning square bracket '['

We have scenario where there is GET API call which extracts "excel" file data from file given file location in the GET call Body. Using: RestAssured with Cucumber BDD The Response comes as: "{\"('Test\/Test1',…
la1
  • 519
  • 1
  • 8
  • 30
0
votes
1 answer

Extract element from json object array

I have below json response. Below response for layer2 object array there can be x number of items {"data": { "layer1": { "layer2": [ { "item1": "result1", "item2":…
Shabar
  • 2,617
  • 11
  • 57
  • 98
0
votes
1 answer

Expressions of JSONPath for rest assured in a list with maven dependesies

I am trying to fetch data which is in JSON format. I am using maven dependency, testng and rest-assured. I want to test Rest API.BUT getting an error of java.lang.NullPointerException Here is my code - public class CountBook { @Test public…
Ferdousi
  • 319
  • 5
  • 17
0
votes
1 answer

In restassurred, how to get particular attribute value using its sibling attribute value in json response of api?

Below is my response { "id": 123, "name": "text1" }, { "id": 456, "name": "text2" } ] I want to find value of id whose name is 'text2'
Rahul D
  • 13
  • 1
0
votes
0 answers

How to update excel values from rest assured json response using apache-poi

I am new to Rest Assured. I have stored below Request in excel and successfully i am retrieving and sending also.. but while sending, i need to add 'Transaction tag' from another api response which i already stored in Object(TTAG). So how to pass…
Shiv
  • 13
  • 4
0
votes
1 answer

API Testing - RestAssured - Looping

I'm doing an assignment for school : Requirement : Create a search ("s) for the items containing "Fantabulous" Verify that the movie with id "tt7713068" is in the list Use a json path to generate a list of movie ID's and loop over it to search for…
0
votes
1 answer

How to extract boolean value from JSON response?

"name": "items", "accept": "application/json", "start": -1, "count": 1, "items": [ { "filterId": "1cb77df1-b580-4576-a956-0f5ba36340b7", "label": "newTest4", "description": "new Filter…
Charu
  • 11
0
votes
2 answers

Java Rest Assured how to update value of nested json object?

I have a json like this: { "application": "ERP", "subject": "Quote 0000005 from TestSG", "exportDocumentRequest": { "documentDate": "05-02-2020", "tenantBillingAddr": null, "code": "0000" } } I need to…
Faisal
  • 159
  • 1
  • 1
  • 13
0
votes
1 answer

Hamcrest matcher to check if any of the element in response json array has a property value same as a specific value in Rest Assured

I am working on REST API test automation with Rest-Assured. For one API I am getting an array like below in response. From that data array I need to check any of the array item has any property "requestRefNo" with value: "Sss/12345637/58" { …
Surodip
  • 457
  • 1
  • 8
  • 21
0
votes
0 answers

Read all Response header and store in String and print them in rest assured java

I have requirement where need to read the all response header and assert them with pre-define values store in the Hashmap. I have written the following codes but getting error as Indexout of bound Boolean IsPass = false; Map.Entry
Vipin Singh
  • 109
  • 1
  • 14