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 error when making a filter query - 'Parse error at %s:%s near token %s (%s)'

So after running the following test code: from jsonpath_ng import parse import json dici = """ { "store": { "book": [ { "category": "reference", "author": "Nigel Rees", …
0
votes
1 answer

What is the supported JDK version for json-path 2.4.0?

What is the supported JDK version for json-path 2.4.0? I went through the homepage, https://github.com/json-path/JsonPath but I couldn't find the supported JDK version. Why I'm looking for this information I'm using JDK15 in my system and when I'm…
Arvind Kumar Avinash
  • 71,965
  • 6
  • 74
  • 110
0
votes
1 answer

Problem filtering jsonpath-plus result set

Using the jsonpath-plus module (typescript), I'm attempting to navigate to a specific object in a json document. The target object is several levels down, and includes passing through 2 levels of arrays. The following jsonpath…
ggfuzzy
  • 1
  • 2
0
votes
1 answer

jsonPath - problem with accessing to field by index

I trying access to value Carrier by taking value from shipping_id. I testing queries at https://www.jsonquerytool.com/. If I type key by hand $.shipping_methods["11"] or $.shipping_methods.11I receive correct result ["Carrier"]. But I have problem…
jasufo
  • 33
  • 4
0
votes
1 answer

Retain only list of jsonPaths from a given json

I have a JSON and a list of jsonPath strings. I want to remove everything from the JSON and only retain the list of jsonPaths I have. I am using Jayway's JsonPath library say my jsonPaths are: $.c $.b[?(@.name=='ironman')] and my JSON is { …
user3602058
  • 219
  • 4
  • 10
0
votes
1 answer

JsonPath array length() returns number of keys instead of elements

I have the following array: "books" : [ { "title" : "History", "id":1 }, { "title" : "The Robotics", "id":2 }, { "title" : "The World", "id":3 } ] and my JsonPath notation is this: $.books[?(@.title == 'History')].length() . I'm…
sparrow2
  • 147
  • 1
  • 11
0
votes
0 answers

How to query a JSON object in Groovy, using only Groovy or native Java libraries

I've tried a few different way of doing this. I have a JSON string that I'm parsing with JSONSlurper that looks like this, and I want to get the value with a key==StoreID2. { "EmailData": { "MessageRecords": [ { …
BenW
  • 737
  • 10
  • 41
0
votes
1 answer

Extract values from Json variable and perform java post processor action

I have the following json value stored in a variable. The json is extracted from other response. DAYS: [ { "date": null, "absent": false, "holiday": false, "exam": [], "blocked": [] }, { "date": "2021-02-21", …
FarFarAway
  • 1,017
  • 3
  • 14
  • 35
0
votes
1 answer

Perform complex jsonpath query

I have the following json response. I want to filter using json path as follows: Get the first date for person ec7e231e-1fed-4860-a1ab-c2e3248a183e where 1. the date is not null and 2. the exam array is empty and 3. the absent flag is false [ { …
FarFarAway
  • 1,017
  • 3
  • 14
  • 35
0
votes
1 answer

Snaplogic - Expression Language Syntax - unique array value

I am using following EL jsonPath($, "$array.map({id: value.get('id'), type: value.get('type') })") which produces the next variable ... But the key(id) is not kept unique ?! [{ "id": "1", "type": "1" }, …
owsata
  • 1,105
  • 1
  • 11
  • 24
0
votes
1 answer

How to conditionally return specific value with another in JSONPath?

I've got an object like this one: { "content": { "iteration_size": 1 } } I need a JSONPath which returns null if the value of next_item is exactly 1, or the value of iteration_size otherwise. So the above should return null and…
l0b0
  • 55,365
  • 30
  • 138
  • 223
0
votes
1 answer

How to extract objects in Jmeter using JSONPath extractor

Hello i am using Jmeters JSONPath extractor, and the i am trying to extract certain fields from a response which is structured like the JSON below. I am trying to only extract the names of the child objects and not the details inside them, so…
KurryF
  • 73
  • 1
  • 1
  • 5
0
votes
1 answer

How to return single value from list after filter using JSON Path extractor?

Using the below example test url for reference i want to return only one value from the result. http://jsonpath.herokuapp.com/?path=$..book[?(@.price%20%3C=%20$[%27expensive%27])] Tried by applying [:1] at the end it doesn't work
0
votes
1 answer

Jmeter JSR223 Method addOptions( com.jayway.jsonpath.Option ) not found in class'com.jayway.jsonpath.Configuration

I'm getting error while running the bellow java code in Jmeter JSR223 sampler import com.jayway.jsonpath.Configuration; import com.jayway.jsonpath.JsonPath; import com.jayway.jsonpath.Option; import net.minidev.json.JSONArray; String json =…
Nikolay Marinov
  • 101
  • 1
  • 3
  • 17
0
votes
2 answers

JsonPath expression for Json String?

I have below JSON String. I need some help with writing a Jayway JsonPath expression that gets assignees for a specific role, say "Editor": { "assignments": [ { "role": { "label": "Editor", "id":…
Deepak
  • 51
  • 7