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

JSONPath find nodes that do not contain a string

I am using stoplight spectral to create rules for linting OpenAPI documents, spectral uses JSONPath plus. I have been using http://jsonpath.com/ to test my JSONPath. I am trying to find urls in this document that do not have the word pet in the…
Gregg
  • 3
  • 3
0
votes
1 answer

Not able to parse & return boolean value using jsonpath

I have a simple JSON(below). The content in the modified array element may vary. I need to have a fixed output whenever the modified element has at least one file name that starts with 'test/' and a different output if none of the file starts with…
0
votes
1 answer

Hyperledger Fabric: Add new organization to existing channel using JsonPath

I want to add a new Organization to an existing Channel in Hyperledger Fabric. First I obtain the channel configuration in JSON format using the following code snippet: byte[] configBytes = channel.getChannelConfigurationBytes(); String…
user10931326
  • 787
  • 2
  • 8
  • 15
0
votes
1 answer

Reading properties of nested elements in from-top-to-down order regardless off nesting level

Given following input data { "foos": [ { "id": "foo", "bars": [ { "id": "1", "bars": [] }, { "id": "2", "bars": [ { "id": "9", …
Alex_M
  • 1,824
  • 1
  • 14
  • 26
0
votes
2 answers

Expected to find an object with property ['xyz'] in path $ but found 'org.json.JSONObject'. This is not a json object according to the JsonProvider:

I am using json-path com.jayway.jsonpath:2.4.0` Java code: public static void main( String[] args ) { JSONObject jObject =new JSONObject("{\r\n \"structure\": {\r\n \"tables\": {\r\n \"category\": \"vehicle\"\r\n }\r\n …
cj devin
  • 1,045
  • 3
  • 13
  • 48
0
votes
1 answer

Fetch the JSONobject value to a variable which is inside the dynamically generated JSONobject

We have below JSON response which has dynamically getting one of the JSONobject which has other objects inside. Tried some of the solutions provided here, but unable to get the values, every time getting 'null'. { "Result": { "12987654":…
la1
  • 519
  • 1
  • 8
  • 30
0
votes
1 answer

Obtain value in json response

How do i write an expression to obtain the value "lastUpdated" in the below json response…
Magnus Jensen
  • 905
  • 6
  • 36
  • 73
0
votes
0 answers

jsonPath return string without brackets

I have the following code: responseBody = '[{"properties":{"gridProperties":{"columnCount":26,"rowCount":1000},"index":3,"sheetId":1682983530,"sheetType":"GRID","title":"kamasi"}}]'; def jsonPathSearch =…
laloune
  • 548
  • 1
  • 9
  • 26
0
votes
1 answer

How to get the required json path?

I had this type of JSON structure and I want to fetch the upper element in the hierarchy on applying condition on lower element in hierarchy { "name": "ninja", "contry": "India", "Account": [ { "id": "123", "orgId": 223, "investment":…
Ninja
  • 433
  • 3
  • 10
0
votes
0 answers

JSON - filter array by string

I am working in MS Power Automate (Flow) and I want to filter a JSON array by a string to retrieve the value... here is a subset of my JSON Data (this data has been extracted from a SharePoint list by a Flow Get Items step): [ { "@odata.etag":…
Our Man in Bananas
  • 5,809
  • 21
  • 91
  • 148
0
votes
2 answers

How to get json path for the given requirement?

I need to find json path for the given json structure { "name": "ninja", "contry": "India", "Account": [ { "id": "123", "orgId": 223, "investment": [ { "invetmentId": "111", "name": "India…
Ninja
  • 433
  • 3
  • 10
0
votes
2 answers

How to check a given json-path expression is syntactically correct?

I need to validate whether the below json-paths are syntactically correct or not: $[*].key1.key2[*].key3.key4 // valid $[*].key1/key2[*].key3"key4 // invalid Is there any API which can check the above json-path expressions and return true/false in…
TheCodeCache
  • 820
  • 1
  • 7
  • 27
0
votes
1 answer

Why are all ids being returned instead of the one matching search criteria

I'm trying to learn JSON path and I'm using the sample at https://codebeautify.org/jsonpath-tester# to practice. I'm trying to extract the id based on the employee's first name as below: $.employees.employee[?(@firstName='Tom')].id However it…
ratsstack
  • 1,012
  • 4
  • 13
  • 32
0
votes
2 answers

Does JSON to XML lose me anything?

We have a program that accepts as data XML, JSON, SQL, OData, etc. For the XML we use Saxon and its XPath support and that works fantastic. For JSON we use the jsonPath library which is not as powerful as XPath 3.1. And jsonPath is a little…
David Thielen
  • 28,723
  • 34
  • 119
  • 193
0
votes
2 answers

extracting value using Jsonpath in gatling scala script

below is my json response and am trying to parse it using Scala in a Gatling script and the value of x is not returned. Can you see what may be the mistake -- [ [ { "x": "2018-01-23", "y": "test" }, { "x":…
55s25
  • 11
  • 2