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
0 answers

Why Jsonpath does not return null if array of jsonArray is null?

I am having the below Json content. { "aaaaaa": { "id": 20956, "bbbbbb": [ {"xxxxxxxx": [] }, {"xxxxxxxx": [1,2] } ] } } And the Json path is…
Piyum Rangana
  • 71
  • 1
  • 9
0
votes
0 answers

What is the JsonPath expression for selecting an object based on sub-object values?

I need to be able to select elements within a JSON document based on the values in sub-elements which, unfortunately, reside in a list of key-value pairs (this is the structure I have to work with). I'm using Jayway 2.4.0. Here is the JSON…
0
votes
1 answer

restassured jsonpath findAll not working as expected

I'm trying to implement a method on java rest assure that find a value querying a JSON file. For this, I use a findAll method for JSONPath from the library io.restassured.path.json.JsonPath in order to access the value needed. for some unknown…
Luis Urea
  • 107
  • 3
  • 12
0
votes
0 answers

Log configurations in my Java application

I'm using a library called JSONPath to parse JSON messages in Java. I should always add the following code to make its redundent logs to disappear. Is there any ways to do this in the log4j .xml file or somewhere other than my code itself? I just…
Tina J
  • 4,983
  • 13
  • 59
  • 125
0
votes
0 answers

is there any way to do reverse comparison using regex in JSON path

I m trying to write JSON path expression using regex, it works fine when i fetch the JSON node and compare with regex, but in my case i have to compare regex with JSON node, I get the JSON node from JSON file and real path from my app, i have to…
0
votes
0 answers

Is it possible that JsonPath work with Collection of Java objects?

I want to filter collection of Java DTO Objects using JsonPath library. I have List with some objects and I want to do something like this: List authors = authorService.getAllAuthors(); List filtered =…
Roman Shmandrovskyi
  • 883
  • 2
  • 8
  • 22
0
votes
1 answer

How take attribut from response and write it to properties?

I have json-response in such form: "f42210c4-2c67-44b2-af6c-07021ed83743" How can I take only guid (without quotes) and record it to properties for future use.
Luka
  • 1
0
votes
1 answer

Find json object by key and replace it with other object from complex/nested json array

I'm trying to find json object by a property/key from a complex/nested json array and replace it with other json object in an angular project. I have used lodash to find json object by key but the json path of object can be anywhere on json…
0
votes
2 answers

Convert Json array into csv using apache Nifi

I'm looking to convert JSON with an array to csv format. The number of elements inside the array is dynamic for each row. I tried using this flow, ( attached the flow file xml on the post ). GetFile --> ConvertRecord --> UpdateAttribute --> PutFile…
0
votes
2 answers

How to split the multiple json objects present in a json array in Apache NiFi?

Example Input is below: I need to split JSON objects present in a JSON array into individual JSON files using Apache NiFi and publish it to a Kafka Topic. There are multiple JSON objects present in the below array [ { "stops": "1 Stop", …
Meghashyam
  • 53
  • 2
  • 6
0
votes
0 answers

How to select only value when JSON filter is applied

I have the following JSON and I need to do 2 things: Select only those entries which has a productionVersion attribute. From these entries only show the id. I managed to this using this json path $.configurations.[?(@.productionVersion)].id From…
0
votes
0 answers

Flatten a json structure in java

So I'm having a minor issue, thinking of what is the easiest way to do this. Basically I have the following JSON: { "users": { "userId1": { "externalUser.userId": "uid1", "externalUser.profileId": "pid1" } }, …
nxn
  • 89
  • 1
  • 10
0
votes
3 answers

Getting String value using JsonPath Java

Im using JsonPath to Assert on some of the values returned from an api response but having a small issue with asserting the response. Heres the response i get: [{"Id":75969,StartDate":"2016-07-01","EndDate":"2021-04-30","duration":5640}] Lets say i…
bobe_b
  • 187
  • 1
  • 2
  • 21
0
votes
1 answer

Jayway JsonPath read String Java

I receive an array of JSON objects, a part of which is below: [{"Team":"LTD","Amount":10000.0,"Success":true}, {"Team":"XYZ","Amount":50000.0,"Success":false}] I want to forcefully read all fields as string so as to make further processing easy…
Gaurav
  • 398
  • 8
  • 23
0
votes
2 answers

How to get the value of "name" field from the json using jsonpath expression

I want to get the value against "name" field from the below json. I tried using the tools http://jsonpathfinder.com/ and http://jsonpath.com/? I am using http://jsonpath.herokuapp.com/ to verify if the expression path is correct, but it always…
RoyalTiger
  • 511
  • 2
  • 8
  • 27
1 2 3
99
100