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 [tag:json-path-expression] for questions about JSON path expressions in general and for questions about JSON path expression DSLs.

Filter by
Sorted by
Tagged with
0
votes
0answers
9 views

How to fetch child value from api response using restassured with Java

I am trying to get the value of child element from the API response using jsonpath. Here is my response from the API ( application/json ). Below is my sample response. { "state": "failed", "tasks": [...
0
votes
0answers
12 views

How to access JSON wrapped by JSON, using JSONPath?

Example: {"c":[{"d":1},{"e":2}]} - apply JSONPath $.c[0].d is results: 1, it's ok, and clear; But how to deal with following JSON: {"c":[{"d":"{\"qwe\":\"rty\"}"},{"e":2}]} - how to access, for ...
0
votes
0answers
13 views

Retrieving complete json arraybased on json path of json object

I'm trying to retrieve the specific JSON array values using json path. Say for example I have 2 json arrays.I want to get index number of 2nd json array using json path { "store": { "book1": [ ...
0
votes
1answer
33 views

how to read multiple levels of JSON data in Big Query using JSON_EXTRACT or JSON_EXTRACT_SCALAR

I am trying to read the below JSON structure in Bigquery using JSON_EXTRACT in Bigquery ..it says unsupported operator Path "*" Tried all the ways I can in BigQuery and Request your help Error: ...
0
votes
0answers
24 views

JSONPath select only leaves

I need to write a JSONPath expression which selects the text value of a key with a given name. The problem is that the same key is present in the document having two different structures; the title ...
1
vote
2answers
57 views

Unable to get value of key with spaces using JsonPath library

I'm using Json Path library to parse JSON. I've following json which has key with space: { "attributes": { "First Name": "Jim", "Last Name": "Rohn" } } In order to get value ...
0
votes
0answers
31 views

Json Path to extract keys using Jayway JsonPath

How to extract keys in Jayway JsonPath using JSON Path? For example: { "key1": "val1", "key2": "val2", "key3": "val3" } It is needed to extract the below: [ "key1", "key2", "key3" ] I ...
0
votes
1answer
44 views

Rest-assured. Is it possible to extract JSONObject/JSONArray from response json?

I'm Using RestAssured, and i'm getting the response like this- { "Data": { "Sub": { "SubDetails": [ { "OrgId": 5, "...
0
votes
1answer
25 views

JSON Path seems to be removing a comma

I'm using JSON Path to extract a some data from a json object. The object looks like this: { "properties": { "random_field": "abc", "max value": "£35,900" } } My ...
1
vote
1answer
50 views

Convert json array to scala list

What is the best way to convert Json Array to scala list, and also Json list is list of JsonObject and they don't have any class in my scala code I don't need it, there my simple json string val ...
3
votes
2answers
70 views

Find rows where value in nested JSON document is greater than INT

I'm a total PostgreSQL newbie. But I think it sounds interesting to use json/jsonb in a relational database. //just for info: I try to realize it by C# .NET Core WebAPI with Dapper I'd like to have ...
0
votes
1answer
24 views

Json-path json extractor that consist from nodes with fullstop in their names

I use com.jayway.jsonpath:json-path for quick accessing and modifying nodes. Example of pattern is: "$.dnode.meta" helps to manage data on meta node level that located inside of dnode. Example of ...
1
vote
1answer
62 views

How to query multiple fields with SelectTokens?

If I've got a JSON array and I want to extract one field from each object, it's fairly simple: Data: { "Values": [ { "Name": "Bill", "Age": "25", "Address": "1234 Easy St." ...
0
votes
0answers
36 views

I need to get information from the command oc get quotas in Openshift

I need to extract some information from the openshift, i am using jsonpath to do it and somenthings i already find how to do. But there are some information that i can't get from the command oc get ...
0
votes
0answers
19 views

Apply json patch to mongodb document

I want to implement HTTP PATCH using Python Flask framework. As an input, I would be receiving JSON patch like: [ { "op": "replace", "path": "/work/title", "value": "Senior Engineer" } ] My ...
1
vote
1answer
63 views

Get an environment variable from kubernetes pods and store it in an array

The use case is to get the environment variable *COUNTRY from all the pods running in a namespace kubectl get pods podname -n namespace -o 'jsonpath={.spec.containers[0].env[?(@.name~="^COUNTRY")]....
-1
votes
1answer
50 views

JSON path for contains

I have the below json { "swagger": "2.0", "info": { "version": "v2", "title": "Portfolio" }, "host": "portfolio.com", "schemes": [ "https" ], "paths": { "/v2/clients/{clientId}/assets": { "get": { "...
0
votes
1answer
64 views

Issue with Java json-path library

all. I'm having a really strange issue with https://github.com/json-path/JsonPath One of the issues seems to be a re-entrant issue that the implentation has: when executing a path, each piece returns ...
0
votes
0answers
39 views

Get sibling's value in JSONPath

Below is my json. There are multiple such arrays in a file. I want to access field bandwidth using name xyz. I am using JSONPath "a": [ { "name": "xyz", ...
0
votes
0answers
10 views

How can i include OR in a single expresssion if the element name changes

I have the following JSON { "General": { "Insurance Type": "Property", "Name": "First_TEST_Profile" } } the json path to this is "$.General.Name" Now the Json at times can come as { "...
1
vote
0answers
33 views

Postgresql argument placeholder in jsonpath expression

I try to pass argument $1 to jsonpath-expression: SELECT 1 FROM %s.orders AS O WHERE order_info @? '$.items[*] ? (@.ProductID == $1)' but it doesn't work. Postgresql is saying: pq: got 1 ...
2
votes
1answer
54 views

Using JSONPath to validate property value?

I'm trying to write a filtering class in C# using Newtonsoft.Json for some JSON documents which has the requirement that we can filter against anything in the JSON document and validate that a ...
0
votes
1answer
97 views

java.lang.NoClassDefFoundError: io/restassured/internal/common/assertion/AssertParameter

I've a Java project and I only need to use json-path library hence I downloaded it json-path-4.1.0.jar from https://repo1.maven.org/maven2/io/rest-assured/json-path/4.1.2/. I placed it under one ...
0
votes
1answer
111 views

JsonPath - Extract object meeting multiple criteria?

In the Json string given below, I want to find all elements in which category = m AND the "middle" array contains elements which match this condition - the element's "middle" array has objects whose ...
0
votes
0answers
12 views

JSONPath help: get subproperty of filtered object

I am having trouble writing a Spring MVC automated test. I have an object like the following (it returns from a table) [ { "id": [guid], "companyId":[string], "itemCode":"EC", ...
1
vote
1answer
31 views

How to use [*] JSONPath Wildcard In order to retrieve array values

I am attempting to retrieve the animalId values from the response. The array is dynamic and so therefore I am attempting to use def animalIds = response.animals[*].animalId to retrieve the animalId ...
1
vote
3answers
74 views

Look for Value in Multiple Keys with JSONPath

With JSONPath, how can you extract a single value from a list of known keys? For example, I want to write one JSON path expression that can extract Sean from all three of these JSON documents: { "...
1
vote
2answers
32 views

Want “null” printed

Let's say I have this data sample:- { "store": { "book": [ { "category": "reference", "author": "Nigel Rees", "title": "Sayings of the Century", ...
0
votes
0answers
22 views

Find JSON path if JSON data has square brackets

Below is the sample Json data: { "Applicant.Applicant[1].Address[1].PostTown": "XXXX", "Applicant.Applicant[1].Address[1].County": "YYY", "Applicant.Applicant[1].Address[1].Postcode": "ZZZ", "...
0
votes
0answers
25 views

How to get values from JsonArray based on keys using JsonPath

I have below Json , and I want to get values from array where keys contains "comment" using JsonPath. { "recordId": 9, "createdBy": "78776", "created": 1574878263811, "id": "...
0
votes
1answer
68 views

how to check key exist in jsonpath camel route?

this is json object below, need to check key is exist in the json object or not, if key is exist and value is empty then i want set 'TH' as default language. please help me and how to do that in camel ...
0
votes
0answers
28 views

Update json nodes in Python using jsonpath

I'm trying to modify json data based on a jsonpath expression: { "SchemeId": 10, "nominations": [ { "nominationId": 1 } ] } Using something like from ...
5
votes
0answers
85 views

AWS step functions and optional parameters

I would like to have a default value for a parameter passed into a step function e.g., "Parameters": { "foo.$": "$.foo" OR "bar" if "$.foo" not specified } is there a way to do this natively ...
1
vote
1answer
47 views

Karate API framework how to match the response values with the table columns?

I have below API response sample { "items": [ { "id":11, "name": "SMITH", "prefix": "SAM", "code": "SSO" }, ...
1
vote
2answers
34 views

Jsonpath issue using ajax

Here I have a code that for some reason Does not pop up any errors but it also does not do what I want it to do which is pull up a list of all the reference Id's from this json file $(function()...
0
votes
0answers
19 views

JsonPath: Access attribute value if parent not null, otherwise null

I am using JsonPath to map jsonString into object, it works so far in a positive case. Code-Snippet: JsonPath.using(jacksonConfiguration) .parse(json) .read("$.shareClassDetail....
0
votes
2answers
81 views

Include variable in jsonpath for oc patch (openshift CLI operations)

In bash I am trying to use a variable in a jsonpath for an openshift patch cli command: OS_OBJECT='sample.k8s.io/element' VALUE='5' oc patch quota "my-object" -p '{"spec":{"hard":{"$OS_OBJECT":"...
0
votes
1answer
15 views

JsonPath that combines fields from a complex object

I am using jsonpath_rw_ext for python currently I am unable to come up with a path string that returns the fields I want without getting errors. I think I can get most of what I'm describing as ...
0
votes
1answer
81 views

Filtering values from kubectl output

I have a k8s cluster and get the list of images if I run: kubectl get pods --all-namespaces -o jsonpath="{..image}" |\ tr -s '[[:space:]]' '\n' |\ sort |\ uniq -c -this works. Now, I have to list ...
1
vote
2answers
73 views

Skip double quotes using JSON path [duplicate]

I have following JSON { "firstName": "John", "lastName" : "doe", "age" : 26, "address" : { "streetAddress": "naist street", "city" : "Nara", "postalCode" : "630-...
0
votes
0answers
60 views

How to query JSON with wildcards and modify the results?

I'd like to be able to query a JSON object and modify it in a way that is structure-agnostic and doesn't involve marshalling to POJOs. Here's an example to illustrate. { "user" : [ { "username" ...
2
votes
2answers
75 views

Get names of keys from JSON in SQL Server

I've got the following JSON. [ { "attributes": { "2003": "Some text", "2004": 0, "2006": 0, "2008": 0, "2011": 0, "2120": 0 }, "path": "/...
1
vote
1answer
47 views

JSONpath to get a value by filter on another value

I have below JSON and i require to validate the status based on given id in my automation script. For that JSON path require [ [ { "id": 9905130204, "category": { "id": 0, ...
0
votes
0answers
47 views

Conditional transformation from jsonpath to jsonpath

We are trying to transform a JsonPath to a different jsonpath as below: Request: { "name" : "Required", "address[0]" : "Required", "address[0].city" : "Optional", "address[0].country" : "...
1
vote
0answers
20 views

How to get list of absolute paths from a given filtered JsonPath expression

I am using following library: com.jayway.JsonPath version 2.4.0 I am processing a json string using the shared JsonPath (filtered) expression, and I need to update different values to the different ...
0
votes
1answer
73 views

Karate API framework is there any way to iterate through the child values

I am getting 90 cent success with my approach but when the response has got multiple entries in one of the child key then the logic gets failed and I am not able to put one common logic in place which ...
0
votes
1answer
70 views

Extract an element value in json using jsonpath

Following is my json data { "primary": [ { "secondary": { "name": { "fullname": "fullname1" }, "alias": "...
1
vote
1answer
81 views

Get String value from JsonPath matching multiple conditions

jsonArray = "[{ "id": "12", "Area": "Room", "Type": "Small", "mode": "Work", }, { "id": "243", "Area": "Hall", "Type": "Large", "...
1
vote
1answer
49 views

How to get certain elements using jsonpath + Python?

I have a file named source.json, the content is { "msg": "OK", "result": { "data": { "articles": [ { "idtArticle": "CF00002", ...
0
votes
0answers
34 views

JsonPath - How to filter elements in an array?

{ "input": [ "abcd", "qwerty" ] } So I have the following input json. I am trying to filter out the second element in the array using jpath. I tried $.input[?(@ ~= abcd)] $....