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

Parse and filter complex JSON Response in Python (the easy compute method)

I have a list of dictionaries (basically JSON Response of an endpoint) I would need to Parse this 16000 lines of json objects and fitler the documents/objects which match criteria that whose leaf element/field : statusInfo/status in not "UP" and of…
Venu S
  • 3,251
  • 1
  • 9
  • 25
0
votes
1 answer

Parsing Git Json with Regular Express

I am taking a Github json file and parsing it with Java's regular expression library JsonPath. I am having a problem parsing arrays that do not have labels. I need to send a email every time a particular file is changed in our repository. Here is…
paulx9000
  • 11
  • 1
0
votes
1 answer

Extract parent node by filtering on child nodes

I need to filter JSON on some child elements and to extract the parent node id. Part of the JSON: [ { "data": { "id": "2da44298-05ec-4bb5-acce-b524ef56328c", "attributes": { "units": [ { "id":…
user270219
  • 91
  • 6
0
votes
3 answers

simple character replacement regex, tokenizing jsonpath

I am trying to tokenize a jsonpath string. For example, given a string like the following: $.sensor.subsensor[0].foo[1][2].temp I want ["$", "sensor", "subsensor", "0", "foo", "1", "2", "temp"] I am terrible with regexs but I managed to come up with…
Jeremy Fisher
  • 2,510
  • 7
  • 30
  • 59
0
votes
1 answer

Jsonpath always returning empty list

I am trying to fetch the values from json file with the help of jayway JsonPath. But everytime it returns empty list. I am trying to use the json path as *.singleAccomViewData import java.util.*; import com.jayway.jsonpath.DocumentContext; import…
shashank sinha
  • 61
  • 2
  • 12
0
votes
0 answers

JsonPath max() issue empty array

I am trying to find the max() for the below json string using JsonPath, but it throws an error Aggregation function attempted to calculate value using empty array. Please let know what will be correct JsonPath to get the max value. [ …
skumar
  • 985
  • 4
  • 14
  • 37
0
votes
0 answers

Is it possible to get a sorted list of attribute values from a JSON array using JSONPath

Given JSON like: [ { "Serial no": 994, }, { "Serial no": 456, } ] I know this query will give me an array of all Serial no values, in the order they are in the JSON: $..['Serial no'] I'm not sure exactly what sorting…
Mr. Boy
  • 60,845
  • 93
  • 320
  • 589
0
votes
2 answers

How can I get only the JSON keys without using tilde sign?

I am trying to get (via JSON Path) only key values from the JSON below but with no success. I cannot use the tilde sign (~) because JMeter's JSON Path Extractor works under JSON PATH 4.0 and ~ is not recognized. { "facetCount": { …
0
votes
2 answers

How to extract "$" by jsonpath?

I'd like to extract an elememt by "$". But it retrieves nothing (the 1st call of main.py). Does anybody know what is wrong? Thanks. $ cat data.json { "id": { "$": { "view": "all", "id": "sec4", "role": "materials-methods" …
user1424739
  • 11,937
  • 17
  • 63
  • 152
0
votes
1 answer

How to stop JSON Path returning object

I'm having an issue with JSONPath work. I have two very similar json objects that I am trying to get values from. Essentially the objects roughly look like this: Object1: {Company: {Organisation: {Official Name: "Name"}} jsonpath1:…
nimgwfc
  • 1,294
  • 1
  • 12
  • 30
0
votes
1 answer

How to escape @ symbol in JSON Path

Here is my JSON object, Obj3: { "cars": { "Nissan": [ {"model":"Sentra", "@doors":4}, {"model":"Maxima", "@doors":4}, {"model":"Skyline", "@doors":2} ], "Ford": [ …
nimgwfc
  • 1,294
  • 1
  • 12
  • 30
0
votes
1 answer

JSONPath and Traverson filtering: single element array

Here is the Json I am trying to handle with Traverson to extract a single link from this HAL: { "_links": { "curies": [ { "href": "https://localhost/auth/def/rels/{rel}", "name": "auth", "templated": true } …
Lisek
  • 753
  • 2
  • 11
  • 31
0
votes
3 answers

JSONPath regular expression - NOT starting with

My JSON (simplified) looks like this: [ {"name" : "foobar", "id" : 123 }, {"name" : "bar", "id" : 123 }, {"name" : "foobar", "id" : 456 }, ... ] I'm using https://jsonpath.herokuapp.com/ to try and find the…
SchmitzIT
  • 9,227
  • 9
  • 65
  • 92
0
votes
1 answer

Parsing exception - jMeter json post processor; while extracting last element of json response

I need to extract the last element from my json response, i am using json post processor. json Path - $.self[(@.length-1)].cashCardId After using this path, i got this error - Exception: Could not parse token starting at position 6. Expected…
Abhinav
  • 51
  • 9
0
votes
1 answer

Parsing with array indices with jsonpath

I have a JSON file with many objects and arrays and objects within the arrays. I have a list of routes between a source and destination in the routes object accessible in the json path - data.offer.travels[1].routes. There are say 15 such routes…
Mihir
  • 491
  • 5
  • 21