Questions tagged [jsonpath]

JSONPath is a means of using XPath-like syntax to query JSON structures. Not to be confused with rest-assured's JsonPath implementation based on Groovy's Gpath. Use the [json-path-expression] tag for questions about JSON path expressions in general and for questions about JSON path expression DSLs.

JSONPath is a means of using XPath-like syntax to query JSON structures.

It is not a standard, but it does offer a means of querying JavaScript structures directly without needing to convert to or from XML.
JSONPath expressions always refer to a JSON structure in the same way as XPath expression are used in combination with an XML document.

Implementations:

Not to be confused with the standard of the same name by rest-assured: https://github.com/rest-assured/rest-assured/wiki/Usage#json-using-jsonpath

1786 questions
0
votes
1 answer

How to compare responses from http calls in gatling?

I have 2 http calls in 2 different function def and saving json keys from response body in gatling session. How can I match them? def getAppData():HttpRequestBuilder = { http("get application resource") .get("host/app") …
anonymous-explorer
  • 365
  • 1
  • 12
  • 26
0
votes
5 answers

Make object key a value in the equivalent sub-object

I have a complex object where the key of each object property should actually be a value. So, I am trying to convert this: { "2019-04-24T00:00:00Z": { "one": 185, }, "2019-04-25T00:00:00Z": { "one": 207, } } to this: { { …
Datacrawler
  • 2,780
  • 8
  • 46
  • 100
0
votes
1 answer

Java JsonPath function "indexOf" gives exception : Arguments to function: 'indexOf' are not closed properly

Im using Jayway JsonPath library version 2.4.0. Using indexOf function in jsonPath, ex. $.values[?(@.num.indexOf('101') != -1)].id Its giving exception Arguments to function: 'indexOf' are not closed properly. But the same works on online jsonPath…
abhijeet104
  • 486
  • 4
  • 9
0
votes
1 answer

Need Xml xpath expression for Saml Auth Token from XML

I have an xml response and from that xml response i wish to extract Saml Token content from this xml but content is nested under xsi:type="xsd:string"> which i am unable to extract I have written below xpath expression //*[local-name() =…
0
votes
1 answer

Is there a way to return an attribute from a JSON object that is the result of a filtered expression?

If I have the following JSON I would like to know if it is possible to return the value "John" provided the following filter expression $[?(@.firstName="John")] is used to match the desired object. { "firstName": "John", "lastName" : "doe", …
Bob
  • 320
  • 1
  • 3
  • 9
0
votes
2 answers

AWS API Gateway only allows the first element of the form data and ignores the rest

I have been trying to push data into AWS SQS using AWS API Gateway, the data I send is in the form of application/x-www-form-urlencoded. And it looks somewhat like this: fruits[]: apple fruits[]: mango fruits[]: banana season: summer Now when I…
0
votes
1 answer

How to search in anonymous and nested array using find or findAll in groovy's closures using REST-Assured library?

I have following JSON response anonymous body and I need to parse nested arrays dynamically to retrieve a key's value based on a condition by using find or findAll in the groovy's closures [ { "children": [ { "attr": { …
Raj
  • 31
  • 1
  • 7
0
votes
1 answer

jsonpath_rw for Python - parsing a specific key

I'm doing an API test. So I have a some response with a json. And I want to get all "firstName" from it. For this goal I'm using a jsonpath_rw tool. But during parsing I get a lot of extra information that I don't need. Here is my…
Dan
  • 67
  • 1
  • 7
0
votes
1 answer

jsonPath expression expected value but return list of values

I want to check response "class_type" value has "REGION". I test springboot API using mockMvc. the MockHttpServletResponse is like this. Status = 200 Error message = null Headers = {Content-Type=[application/json;charset=UTF-8]} Content type =…
horoyoi o
  • 584
  • 1
  • 8
  • 29
0
votes
1 answer

Gatling: execute a check on some JSON hidden inside an HTML response

In Gatling, I'd like to perform a check on some JSON included in an HTML response like below:
Arnianor
  • 43
  • 1
  • 6
0
votes
1 answer

Overriding existing property of json, or adding next if not present in json

I have some JSON, declared as string for my testing purposes in main method. My goal is to use JSONPATH with DocumentContext, to override property if property exists, and to add it if it does not exists. Is there possibility to achieve that ? My…
zawarudo
  • 1,907
  • 2
  • 10
  • 20
0
votes
1 answer

How to send access_token which is generated in saveAs("access_token") to be sent to ElFileBody of Gatlin Soap Request

I have this code for gatling where i wish to pass auth_token to soap request body. Soap request body is written in a txt file and that txt file is called in ElFilebody All i need is to send access_token which is generated in saveAs("access_token")…
0
votes
1 answer

How to find specific element in JSON without model

I have a JSON data like this … { { "School": "ABC School", "School Address": [ { "Office": "Road No 123" }, { "Admin Office": "Road No 321" }, { "Admission Office": "Road No 456" } ], "School Brach": [ { "Brach name": "North…
Biswajit
  • 323
  • 4
  • 15
0
votes
1 answer

Valid jsonpath gives UnsupportedOperationException, CriteriaType can not be parsed

This JsonPath $.accounts[?('abc' in @.contact_ids)].user_id gives in error when run in java: com.jayway.jsonpath.InvalidPathException: java.lang.UnsupportedOperationException: CriteriaType can not be parsed but works perfect on…
user3419148
  • 111
  • 1
  • 8
0
votes
1 answer

How comapre 2 json filtered with multiple json path with single comparisson?

There are 2 json, there multiple paths which is needed to be applied on both json. Then these jsons should be compared via some assert in test. The ide solution whould be: Stirng actualJson - .... Stirng expectedJson - .... Stirng actualJsonFiltered…
Cherry
  • 31,309
  • 66
  • 224
  • 364