Questions tagged [jayway]

69 questions
1
vote
1 answer

How to extract array element without key?

I have a json as below. I want a json path expression that checks if [e3] exists in the below json. Can someone help please? { "status": "ok", "error": [ "[e1]", "[e2]", "[e3]", "[e4]" ] }
Anoop
  • 51
  • 5
1
vote
1 answer

JSONPath how to filter out objects that contains lists of empty objects?

I'm trying to use JSONPath (Jayway implementation), to get objects that contains a values array, that contains at least 1 non empty value. This is a simplified data I get from some service: [ { "feature" : "city", "values" : [ { …
najczuk
  • 133
  • 1
  • 8
1
vote
1 answer

Get custom object by id from json java jsonpath

I'am trying to get User object from json by Jayway JsonPath. My class is: public class User{ private String id; private String name; private String password; private String email; /*getters setters constructor*/ } And json…
1
vote
1 answer

Retrieve Parent node element from Json

I want to retrieve parent element along with the child element while filtering. Please find the below XML: { "store": { "book": [ { "category": "reference", "author": "Nigel Rees", …
1
vote
1 answer

How to combine two attribute from a json to create json predicate with in clause in Java?

I have a json as below { "store": { "book": [ { "category": "reference", "author": "Nigel Rees", "title": "Sayings of the Century", "price": 8.95, …
1
vote
1 answer

How to get the whole json with the result reflected after filter by string using JsonPath

Can I get the whole json with the result reflected after filter by string using JsonPath? Before JSON { "store": { "book": [ { "category": "reference", "author": "Nigel Rees", …
H.jenny
  • 171
  • 1
  • 2
  • 11
1
vote
1 answer

Update JSON response from an API and pass the updated response as input/body to another API using Rest Assured

I am currently calling an API using Rest-Assured, whose response body is posted below. i need to pick a portion of the response, i.e. whole of WorkItems tag(at line 3), and update the fields "CorrelationUId" and "Value"(node within…
Sonal
  • 55
  • 8
1
vote
1 answer

How to extract data from json where parameter has white space character

I have json [ { "name": "Name1", "address": "City1\nCountry1" }, { "name": "Name2", "address": "City2 Country2" } ] And I am using jayway library to extract "name" using "address". I want to parameterize the "address" using…
1
vote
3 answers

JsonPath: find an element in an array by field

I have an anonymous array of objects and I'd like to find an object by a specific field. I tried this: jsonPath.get("$.[?(@.name == 'David')]") but I'm getting the following error: Invalid JSON expression: Script1.groovy: 1: Unexpected input: ' …
IsaacLevon
  • 2,260
  • 4
  • 41
  • 83
1
vote
1 answer

Unable to find/import 'io.rest-assured' packages even after adding to Maven Project

I have added the below dependencies to the maven project pom.xml file and i did a mvn clean, install. I can see the dependencies added to the .m2 folder in my c-drive/users, but they are not listed under the IntelliJ "External Libraries" section.…
1
vote
1 answer

Jayway JSONPath Expession for Both Object and Array

I am having to trouble to retrieve value if parent element can be JSONArray as well as JSONObject. For that I used Deepcopy syntax to retrieve it. Now Problem is am getting additional values if child attribute exists in Inner Array…
1
vote
2 answers

Parse JSON having both Escape & Unescape characters in JAVA using Jayway

I receive the below json as an input to my program: { "shopping": { "cart": { "items": [{ "iturl" : "https://www.google.com/", "itdesc" : "Item’s box includes the below contents:\n a.adaptor \n…
Ponram R
  • 11
  • 1
1
vote
1 answer

Retrieve JSON element using JsonPath- Jayway

I have a below JSON. I want to get pin code where street =='abc strt.' I am using Jaway to achieve this. { "studentId": "10001", "studentSection": "A", "address": [ { "street": "abc strt.", "pincode": "00000000" }, { …
mayank bisht
  • 618
  • 3
  • 14
  • 43
1
vote
0 answers

java.lang.NoSuchFieldError: defaultReader (JsonSmartJsonProvider.java:39)

I am using json-path-2.4.0 library in spark jobs which has a dependency on json-smart 2.x , but the spark jars default classpath folder (/usr/hdp/2.6.5.0-292/spark2/jars/) has json-smart 1.x which always gets precedence and I am unable to use the…
Subbu
  • 21
  • 1
  • 5
1
vote
1 answer

Jayway jsonpath starting with "/" in regex

I am having issues with jayway jsonpath when it comes to using regex which has xpath in it. Here is my json: { "status": "success", "resources": [ { "id": "Attachment-20796b26-7a16-4a3d-b53c-b30d9f3cb798.TXT", "name":…
Daniel
  • 11
  • 2