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

How to apply jsonpath query to get the object?

The question in detail is, I have a node js code 'app.js' var fire = require('jsonpath') let Config = JSON.parse(fs.readFileSync('./config.json', 'utf-8')) var obj = { "key1" : "val1", "key2" : "val2", "key3" : "val3", "key4" :…
0
votes
1 answer

how to remove [] character at extracted json using json path

{ "responseCode": "200", "data": { "sequence": 1, "used": true, "sensingTags": [ { "code": "LED", "value": 1, "updatedOn": 1587557350251 } …
0
votes
1 answer

How to fetch a specific object from JSON using JSONPATH by putting the local variable in query string?

I am exploring about JSONPATH. And I used it in JS to fetch some specific data from the parent JSON. Let's say the JSON object that I have is, var JSON_OBJECT = { "data" : [ { "firstname" : "abn", "Lastname" : "Bis" …
0
votes
1 answer

Laravel/PDO JSONPATH request on Postgresql

I am trying to make a jsonpath request on a postgresql with laravel/pdo. Here is what I need to archieve. SELECT i.id as id, i.modele_id as modele_id, i.data as data, m.nom as modele_nom FROM items i JOIN modeles m ON (i.modele_id = m.id) WHERE m.id…
Léal
  • 19
  • 5
0
votes
1 answer

How to get VALUE by KEY in Json?

Given: [{"{#NAME}":"BULL","{#VALUE}":"98.03"},{"{#NAME}":"BILL","{#VALUE}":"98.32"}] How get VALUE by NAME ? My code didn't working :( $['{#NAME}']['VALUE']
depak
  • 128
  • 1
  • 9
0
votes
1 answer

Retrieve get a jsonNode form the input json in java8

I have he following jsonObject: { "payloadTesting": { "A": "a", "B": 21, "node that I want to remove": { "C": "123", "D": "456" } } } What I want to to is to go to the location of the 'node that I want to remove'…
carlos
  • 63
  • 1
  • 1
  • 4
0
votes
1 answer

how to make jsonpath work for name-value pair

I have json like the one i have attached. I want to read id under processorMap, if processorMap.id matches to the criteria. for e.g. if i search value "set value for mongo" then I should be getting => 1c9b2d18-e9ab-3512-803a-c1ee5f7a2793 I tested my…
Rakesh Prasad
  • 602
  • 1
  • 13
  • 32
0
votes
0 answers

JsonPath expression returning a sibling of the parent after filtering on parent's child

I'm trying to write a JsonPath expression returning a sibling of the parent after filtering on parent's child. Hers's the JSON: { "data":[ { "id":1, "date":"2018-10-16T00:00:00.000Z", "home_team_score":105, …
0
votes
1 answer

Cannot resolve method 'read' in 'JsonPath'

I currently have a gradle project where I have a line implementation "com.jayway.jsonpath:json-path:2.4.0" in my build.gradle file. In my code, I have an import statement import org.springframework.data.web.JsonPath;, but when I actually use the…
kaido
  • 321
  • 1
  • 5
  • 15
0
votes
1 answer

Solr java.lang.ClassNotFoundException: net.minidev.json.writer.JsonReaderI when executing DataImportHandler

I am currently working on a custom DataImportHandler for Solr 8.4.1. I wrote my own entity processor class where I used the json-path library. And even though the solr-dataimporthandler (which I have to import in my custom class) seems to already…
0
votes
1 answer

How to get the output via jsonpath with kubectl

I run kubectl get events to get the events details, now I'd like to do a fuzzy search to get the particular pods with prefix nginx-* Suppose, I have this output as below $ kubectl get events -o json { "apiVersion": "v1", "items": [ …
Bill
  • 2,494
  • 5
  • 26
  • 61
0
votes
1 answer

Using JsonPath to extract inhomogeneous list as typed objects

I need to parse json with a list of inhomogeneous "items" i.e. each may have different keys/structure but they share one common key (here called "a") that gives the type of the item. { "items":[ {"a":1, "d":2}, {"a":2, "b":{"c":2}} …
0
votes
1 answer

Karate API json response - How to validate the presence of a key which sometimes come and sometimes not in the API response

I need help in validating the presence of one key in the response. The response of the API looks like - "persons": [ { "id": "27", "source": { "personId": 281, "emailAddress":…
vdrulerz
  • 264
  • 3
  • 13
0
votes
0 answers

JsonPath query?

I have a JSON file like this: { "Resources": { "myresource1": { "Properties": { "keyA": { "Ref": "resource2" }, "keyB": "something", "keyC": { "another object": { "Ref":…
Maria Ines Parnisari
  • 16,584
  • 9
  • 85
  • 130
0
votes
0 answers

Is there a string-based lens for runtime field access?

Similar to this question, but even more runtime-ey. Is there a way to automatically generate lenses, or any other mechanism, for accessing fields by name at runtime? I'm looking for something similar to field from generic-lens, except taking the…
Isaac van Bakel
  • 1,772
  • 10
  • 22