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 For multiple object

I want to know the name who purchased items "abc" and "def" from the bellow json data. (Expected result is "tom") Please tell me how to do using JsonPath. [ { "name": "tom", "purchased": [ { "name": "abc" }, { …
0
votes
1 answer

Apache Camel test and assert the JSON body field value with JSON Path Expression

I'm trying to check the field value of the body which is a JSON string with JsonPathExpression. In the example below, the JsonPathExpression checks whether or not the root JSON object has the field named as "type". What I want to achieve is, to…
Levent Divilioglu
  • 11,198
  • 5
  • 59
  • 106
0
votes
1 answer

JSON for multiple parent table's and one child table

Generate JSON in such a way that JSON for child table should have ARRAY_WRAPPER and JSON for parent table should NOT have ARRAY_WRAPPER and Query should be on PARENT1 table on column P1NAME in ('kumar,pathan'), so the output should have 2 rows I…
gous md
  • 127
  • 3
  • 10
0
votes
1 answer

Generate JSON in such a way that JSON for child table should have ARRAY_WRAPPER and JSON for parent table should NOT have ARRAY_WRAPPER

Generate JSON in such a way that JSON for child table should have ARRAY_WRAPPER and JSON for parent table should NOT have ARRAY_WRAPPER and Query should be on PARENT1 table on column P1NAME in ('kumar,pathan'), so output should have 2 rows I have…
user2192023
  • 1,601
  • 2
  • 11
  • 12
0
votes
1 answer

Cannot use JsonPath libraries in browser due to "unsafe-eval" CSP directive

I want to use some JsonPath library in browser, but they all relying on eval()/Function() that get caught with unsafe-eval by CSP. And any other workarounds/3rd party libraries like static-eval/safe-eval also all get caught with the same console…
Allen
  • 4,431
  • 2
  • 27
  • 39
0
votes
1 answer

Extract a list of profileId's using jsonpath

I have the following JSON object r2, [ { "reserva_id":"200", "estancias":[ { "reserva_estancia":"266", "huespedes":[ { "reserva_huesped":"272", …
DMi
  • 31
  • 4
0
votes
1 answer

Talend json file extract

I have a valid json file (checked it on online validator). I'm using tExtractJsonFields to extract the data. when I use JsonPath all is good but when I try to use xPath I get this error: The content of elements must consist of well-formed character…
jayzee
  • 195
  • 1
  • 17
0
votes
4 answers

Print the namespace of the current context in Kubernetes

I'd like to print the namespace of the current context in Kubernetes. oc config view -o json returns the following output (shortened for readability) { "kind": "Config", "apiVersion": "v1", "contexts": [ { "name":…
Philippe
  • 157
  • 1
  • 11
0
votes
1 answer

JsonPath selecting object field if multiple condition matches

{ "userName": "test" "customer": { "mode": "BANK", "modeDetails": { "accountNo": "12345678901001", "walletId": "11324354@paypal" } } } I am using jsonpath to select accountNo if…
Kurukshetran
  • 75
  • 2
  • 12
0
votes
0 answers

JsonPath is too slow

I am using JsonPath to retrive an array from a ~30 MB json file. The reason for that is when loading the file into a bufferedReader, the app crashes due to lack of memory. The problem is it takes so long (~2 min) to get one array using one call.…
Ali_Habeeb
  • 205
  • 2
  • 9
0
votes
1 answer

Is there a way to validate the whole JSON response using SOAPUI?

I tried using "COntains" option in SoapUI but it is not working so I tried Jsonpath ut I can't figure out how to. Previously when I did XML request, I just use "COntains" and copy the whole response on the assertion. But I cannot find to wor on it…
0
votes
1 answer

JSON Path Combining

I have a json file like…
0
votes
1 answer

JSONPath - Filter expression to print a field if an array contains a string

I have the following JSON and am trying to write a JSON Path expression which will return me the isbn number when I have a id of either '123456789' or '987654321'. I tried the following but this did not work. Can anybody tell me what I am doing…
user1107753
  • 1,566
  • 4
  • 24
  • 36
0
votes
1 answer

Add string literal into JSONPath output

Can I add a string literal to a JSONPath selector? { "items": [ { "x": 1 }, { "x": 2 }, { "x": 3 }, { "x": 4 }] } $.items[:].x gives... [ 1, 2, 3, 4 ] For example, can I make it return... [ { 1 }, { 2 }, { 3 }, { 4…
Ian Warburton
  • 15,170
  • 23
  • 107
  • 189
0
votes
1 answer

Use JsonPath to read nested array properties

[ { "path": "test", "resources": [ { "name": "testfile" } ] }, { "path": "test-1", "resources": [ { "name": "testfile-1" } ] } ] Given a json like above, is it possible to read…
varun
  • 684
  • 1
  • 11
  • 30