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

Consuming large JSON file with Apache Camel

I am trying to consume large JSON file with records in form of JSON Array using apache camel. I am using split() with jsonpath("$") to split the records which returns Map and works fine with small files. But for large files, it is loading everything…
0
votes
1 answer

Json path - how to get "id" only from the part with "requests" and given "title":"subject_2" parameter?

I have a response: {"myRequests":[], "requests":[ {"id":"4919fe948-f4bb-4863","profileId":1,"comments":"","title":"subject_1" ...(bla-bla-bla)...,"name":"Perf_1"}, {"id":"7295814a1-d1e7-440d","profileId":1,"comments":"","title":"subject_2"…
Nadezhda T
  • 262
  • 8
  • 24
0
votes
1 answer

Wiremock matchesJsonPath checking array values ignoring the order

I am trying to improve the code to prevent errors. I have a couple of requests that can come in these forms, 1: { "idUser": "1234",, "ids": ["3", "1"] } or 2: { "idUser": "1234",, "ids": ["1", "3"] } And I have this Json Match: { …
abeld89
  • 57
  • 4
  • 11
0
votes
0 answers

PostgreSQL: how to get index in jsonb array of found object by jsonpath

Let I have a JSONb data: { "track": { "segments": [ { "location": [ 47.763, 13.4034 ], "start time": "2018-10-14 10:05:14", "HR": 73 }, { "location": [ 47.706, 13.2635 ], "start…
0
votes
1 answer

Filter json children without data

Is it possibile to extract all the childrens of a parent node without respective data? For example, using jsonpath, I'd want list all options available under "spec", like below containers restartPolicy dnsPolicy { "kind": "Pod", …
igpix
  • 1
  • 3
0
votes
1 answer

How to filter a JSON by a string value contained in an array inside JSON using JSONPath

I am listing down my sample JSON below, I want to write a JSONPath that selects element when subjects has (or contains) "Maths". NOTE: I am using Goessner's JSONPath using Newtonsoft library (C#)** { "class":{ "type":"group", …
0
votes
1 answer

Nesting expressions in Wiremock

I am trying to nest expressions in Wiremock and I get an error. Is it possible to nest a randomValue inside the pickRandom helper? Example: I have a wiremock stub that returns: "{{{pickRandom '{\"test\": \"1\"}' '{\"test\": \"{{randomValue…
0
votes
0 answers

JsonPath return result different for the json object from json string

I am using JsonPath-2.4.0.jar and while trying to extract object type value from json getting different result. String json="{\r\n \"array\": [\r\n 1,\r\n 2,\r\n 3\r\n ],\r\n \"boolean\": true,\r\n \"color\": \"gold\",\r\n \"null\":…
cj devin
  • 1,045
  • 3
  • 13
  • 48
0
votes
1 answer

How to get a json value dynamically?

in Jmeter, for the message below i want to get the value of tag CC2650HumidityData (or tag name and tag value) but I don't know the name of tag; it is contained in a variable. I've used this json…
sarjaana
  • 77
  • 1
  • 1
  • 6
0
votes
0 answers

Create JSON from path using java

I need to create a JSON from path. for e.g my paths and its values looks like below root/departments[name=dept1]/employees[id=emp1]/firstName = firstName root/departments[name=dept1]/employees[id=emp1]/lastName =…
p_nair
  • 57
  • 1
  • 1
  • 5
0
votes
1 answer

Using JsonPath how can I get the inner value of these json objects

Say I have some json like this that I am parsing with JsonPath: { A: {key: "1"} B: {key: "1"} C: {key: "1"} D: {key: "1"} E: {key: "1"} } or { A: {key: "7"} B: {key: "7"} E: {key: "7"} G: {key: "7"} } A, B, C, D, E, ..., etc…
Jared DuPont
  • 165
  • 2
  • 14
0
votes
1 answer

How can I create a JSONPath filter expression to search using contains keyword

I have a requirement where I am trying to select objects inside a JSON string by filtering on the presence contains values on properties of objects inside a JSON array. Here is an example of my JSON array: var Json_String = [{ 'Identifier': 1, …
user4155
  • 1
  • 2
0
votes
1 answer

How to collect all other values for a tag within JSON even when the exception `com.jayway.jsonpath.PathNotFoundException` is thrown?

Consider the code snippet below- { "header": { "systemId": "1" }, "body": { "approvalType": "S", "requester": "CRM", "approver": "V", "additionalInfoList": [ { …
Farhan stands with Palestine
  • 13,890
  • 13
  • 58
  • 105
0
votes
1 answer

how to use kubectl -o jsonpath if key have '.'?

I went to get a value in yaml. so I use a kubeclt ~~ -o jsonpath=~~~ if key have '.' what should command make? ex) apiVersion: v1 items: apiVersion: v1 kind:…
0
votes
1 answer

Extract fields from Postgres jsonb

I'm trying to find an efficient way to extract specific fields from a Postgres jsonb column. CREATE TABLE foo ( id integer, data jsonb ) "data" contains a row with: { "firstname": "bob", "lastname": "smith, "tags": ["tag0","tag1"] } I…
ccleve
  • 15,239
  • 27
  • 91
  • 157