Questions tagged [json-path-expression]

A JSON path expression is an expression, possibly in a domain-specific language, specifying a path to to one or more values within a JSON text. The expression may include filters.

Javascript provides a well-known notation for JSON path expressions. JSONPath and JMSEPath are well-known DSLs for JSON path expressions. In jq, any JSON array consisting solely of strings and/or integers can be used as a path expression.

179 questions
1
vote
2 answers

How to Add New Array Index in JSON using JsonPath?

I'm trying to add one more index value to the path: $.data.library.category[2].book using jayway jsonpath in following Json, "data":{ "library":{ "class":"CRED", "category":[{ "book":"java 2.0" }, …
Magesh Magi
  • 11
  • 1
  • 2
1
vote
1 answer

json path expression to get root key

I have this json: { "-1": { "description": "test1" }, "222": { "description": "test2" }, "223": { "description": "test3" }, "224": { "description": "test4" }, …
sarjaana
  • 77
  • 1
  • 1
  • 6
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

Select a JSON attribute based on other elements within an array using JSONPath

I have a sample JSON array: { "data": { "list": [ { "id": 192, "name": "John Black", "username": "jblack", "email": "jblack@myorganization.com", "extern_uid": "user…
masterful
  • 31
  • 4
1
vote
2 answers

How to filter a complex response in karate dsl using jsonPath?

I am getting below response from a REST API, but I am finding it difficult to extract label value from the received response and assign it to a variable to use it later in script. Here is the RESPONSE:: { "result": "SUCCESS", "rawAttr":…
rahoolm
  • 733
  • 2
  • 12
  • 22
1
vote
1 answer

Karate Framework JSON path parsing using regex not working for the whole word match

I am working on matching the name for eg. name in the response says: 'World map' Now I want to write a generic regex in the karate jsonpath which should work for the word "map" irrespective of its position in the multiple words for eg - One common…
vdrulerz
  • 264
  • 3
  • 13
1
vote
0 answers

How to sort and filter datasourcebindings in Extension task.json while populating a picklist

I am using an API to get the available AKS Versions in a pick list in my Utility. I want to show only latest 4 versions in high to low order. The current version of my code gives all of the available versions in that region- { "name":…
1
vote
1 answer

JSON-Path only returns single character instead of full value

I have a problem selecting the full value from a specific filter-selection. Input JSON (from github-api response): [ { "name": "V2.X.X", "prerelease": true }, { "name": "2.0.0", "prerelease": false }, { "name":…
APIMAN
  • 51
  • 4
1
vote
0 answers

Karate Framework JSON path parsing using regex not working for carriage return

I am working on parsing the name and description value on the basis of the API body but it fails to capture using below code ... it is failing in parsing those description values which is having \r\n in the description text. $..source..[?(@.name =~…
vdrulerz
  • 264
  • 3
  • 13
1
vote
0 answers

com.jayway.jsonpath.InvalidPathException: Space not allowed in path

I'm using JsonPath to check matches of some json-paths against a JSON document with a SpringBoot application. It gives the following exception when I include in operator inside the expression. But the same jsonpath expression works fine online. I…
1
vote
0 answers

How can I filter non array element in json path?

JSONPath filter only returns a result if the object is an array. I have this json string: { "books": { "author": "https://tpp-ob.com/callback", "price": "SandboxASPSP1" }, "format": [ "paper" ], "onSaleSince":…
Dagua
  • 51
  • 4
1
vote
0 answers

Camel CBR with JSONPath filter expression, getting InvalidPathException

I am trying to implement Camel CBR based on JSONPath filter expressions. Body (JSON structure) is as follows : { "orderId": "315973", "status": "Complete", "entity": { ... } } My route is as follows : // Unimportant…
fg78nc
  • 4,774
  • 3
  • 19
  • 32
1
vote
0 answers

Complex json validation with JsonPath

Im trying to validate the below json using Jsonpath. I am not able to validate any values after the "fieldMap". I get No JSON path error on everything that I tried. Please advise on how to validate the json string. { "Identifier":…
emjay
  • 33
  • 1
  • 3
1
vote
2 answers

Json Path - Filter on List of List

I have a JSON like this: { "DATA": [ { "docName": "xyz", "result": [ { "attribute": "attr1", "value": true }, { "attribute": "attr2", "value": true } ] }, { "docName":…
AgentX
  • 1,402
  • 3
  • 23
  • 38
0
votes
0 answers

How do use json-path to select fields of a particular type?

Trying to render a Slack template in their blocks format which is json. I want to pull out text string to update them before sending off the message. The problem is that text can be an object or string. I'm getting the keys with expression…
gph
  • 1,045
  • 8
  • 25