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
1answer
19 views

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 ...
0
votes
0answers
16 views

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": { ...
1
vote
1answer
19 views

Filter nodes by a boolean value

I have to filter JSON by IsNew parameter (true or false) Part of the JSON is below: { "data": [ { "type": "users", "attributes": { "first-name": "student21", "last-name": "...
0
votes
3answers
30 views

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 ...
0
votes
1answer
34 views

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.*; ...
0
votes
0answers
20 views

JsonPath SelectToken not working for recursive structure

I have the following JSON on which I want to get specific values using SelectToken - { "Result": { "Id": "knownvalue0", "Name": "Level0", "Children": [ { "Name": "Level1",...
0
votes
1answer
39 views

How to remove brackets when using property transfer?

I'm a beginner on soapUI. Since yesterday, I'm working on transferring property from a response to a parameter of another API. I'm trying this with an API of OpenStreetMap that converts address into ...
0
votes
0answers
18 views

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 ...
0
votes
0answers
14 views

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: $...
0
votes
2answers
33 views

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 ...
5
votes
1answer
80 views

Using JSONPath to filter properties in JSON documents

I have an arbitrarily defined JSON document, and I want to be able to apply a JSONPath expression like a whitelist filter for properties: All selected nodes and their ancestors back to the root node ...
0
votes
1answer
69 views

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", "...
1
vote
0answers
21 views

Jsonpath doesn't work when used out of Angular Library Bundle

I have a project where I'm creating an Angular Library, that is imported in another app as a UMD bundle. I wanted to use Jsonpath library to parse json in one of the components in the library. When I ...
1
vote
1answer
17 views

How to select an element which has () in it using JSON

I am using RestAssured for API automation and as a part of it I have to extract a value from the JSON reponse. JSON reponse is given below { "resourceName": "SERVICE_STATUS", "records": [ { ...
0
votes
1answer
28 views

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: {...
1
vote
0answers
13 views

JSONPath format returned values

I am doing some JSONPath plus queries and wondering if I can format the values returned? For example, I have a path below which returns three values: day, month and year. $..CONTRACT_AWARD_DATE.* ...
0
votes
1answer
20 views

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} ...
0
votes
0answers
16 views

What could be the reason for the below exception?

invocation failure, caused by: java.lang.NoSuchMethodError: com.jayway.jsonpath.JsonPath.read(Ljava/lang/String;Ljava/lang/String;[Lcom/jayway/jsonpath/Predicate;)Ljava/lang/Object; (com.microstrategy....
1
vote
1answer
57 views

Can't figure out how to insert keys and values of nested JSON data into SQL rows with NiFi

I'm working on a personal project and very new (learning as I go) to JSON, NiFi, SQL, etc., so forgive any confusing language used here or a potentially really obvious solution. I can clarify as ...
0
votes
0answers
33 views

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}", "...
2
votes
1answer
37 views

Caused by: com.jayway.jsonpath.PathNotFoundException Error

I am writing test case for my controller. And, I am using .andExpect method to match jsonpath expression. Below is my code: @Test public void getALLEmails() throws Exception { Email ...
1
vote
1answer
22 views

Is there any way to bind jsonpath dynamically in angular 6

I am creating a reusable component in which I can pass any dynamic json so he'll able to handle that what I tried is mycomponent.html: <div *ngFor="let Node of items"> {{ Node[getPath()]}}&...
0
votes
0answers
21 views

Mocha Chai check if Json response contains specific property

I'm creating API test which checks that the response contains specific key "textId" in structure: it('TC-4 /rest/passwords/ should change "password"', function() { return chai.request(serverurl)...
0
votes
0answers
37 views

Using the OR operator (|) in jsonpath-ng python

I have a json structure (client_json) that looks like: client_json = { "data": [ { "attributes": { "creators": [ { "name": "This is a person", "nameType": "Personal", "givenName": "the", "familyName":...
0
votes
0answers
28 views

How to get root node name in JSON using json path

Is there any way using json path to get only root element name, I have jayway implementation and can use only json path. Tried ~ and ^ suggested in documents but didnt return root element name.
0
votes
3answers
54 views

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 ...
0
votes
1answer
41 views

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: ...
0
votes
1answer
50 views

Conditional jsonpath expressions not working in groovy script, jmeter

Conditional jsonpath expression: $.[?(@.identifier == "369")]..columns.[?(@.type == "relationship")].token Problem 01: groovy script in jsr233 post processor not parsing the jsonpath expression. ...
0
votes
1answer
103 views

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....
1
vote
2answers
45 views

JsonPath - Restrict $..id Operator To Avoid Traversing Object Hierarchy

I was trying to extract data from a JSON object using jsonpath package for following JSON structure - [ { "id": 1, "images": [ { "id": 1,"url": "http://url1.jpg" }, ...
1
vote
1answer
32 views

Expression with String placeholder in the filter part of JsonPath using karate

I am trying to filter my response using JSON Path where one of the condition using a value from a variable but I am not able to map variable properly, so my filter not working properly. Sample ...
0
votes
0answers
12 views

How to fix invalid expression errors while writing JSON Path expressions to return all the keys of a JSON file?

I'm trying to write a JSON path expression for returning all the keys in the JSON file. I have to use that in one of my JUnit test cases. My JSON file format is simple as follows - [ { "Key1": ...
0
votes
0answers
25 views

JSON Path 2.3.0 conflicts with hadoop 2.7 Environment JSON-smart1.2.0.jar

Have a Input of JSON inside HDFS location It is required to parse the JSON and to aggregate results To do am using the PIG UDF which are using JSON-path libraries On the hadoop2.7 environment jar: ...
0
votes
0answers
28 views

Dynamic Indexing through Jsonpath

I was trying to retrieve an array value from a json, with index specified as another key in the json. Templating Language being used : Freemarker. Sample JSON: { "index": 1, "array": [ ...
0
votes
5answers
79 views

Make object key a value in the equivalent sub-object

I have a complex object where the key of each object property should actually be a value. So, I am trying to convert this: { "2019-04-24T00:00:00Z": { "one": 185, }, "2019-04-25T00:00:00Z": ...
0
votes
1answer
62 views

Java JsonPath function “indexOf” gives exception : Arguments to function: 'indexOf' are not closed properly

Im using Jayway JsonPath library version 2.4.0. Using indexOf function in jsonPath, ex. $.values[?(@.num.indexOf('101') != -1)].id Its giving exception Arguments to function: 'indexOf' are not ...
1
vote
0answers
55 views

aws codepipeline webhook filter

I need to create an aws codepipeline webhook to github using terraform that will filter the events coming from github to only events that are from a specific branch and prefix of files that are added, ...
0
votes
0answers
101 views

JsonPath - report all assertions even if one fails

I have the following code in my Spring MVC application: mockMvc.perform(get(/api/some-endpoint)) .andExpect(status().isOk()) .andExpect(jsonPath("$.key0").exists()) .andExpect(jsonPath("$....
0
votes
0answers
28 views

JsonPath that gets parent elements along with each child

I'm trying to get json results that include certain parent values. Say I have json like this: { "array": [{ "parent_id": "A", "children": [{ "id": "a1" ...
0
votes
0answers
17 views

JPath filter using Regex

got the following JSONs: { "timestamp": 1561468693060, "status": 500, "error": "Internal Server Error", "exception": "org.springframework.web.client.HttpServerErrorException", "message": "...
1
vote
1answer
38 views

Using a $ref and other properties within a JSON Schema

In a JSON Schema is is valid to have a $ref and then other properties within the same schema, for example. { "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "title"...
0
votes
0answers
18 views

How to list all attributes of a json object in jsonpath?

I have a json document and within that document, I have an object that I want to validate strictly: if there are unexpected attributes, I want to throw an assertion error. But in order to do that, I ...
0
votes
1answer
29 views

Is there a way to return an attribute from a JSON object that is the result of a filtered expression?

If I have the following JSON I would like to know if it is possible to return the value "John" provided the following filter expression $[?(@.firstName="John")] is used to match the desired object. { ...
0
votes
0answers
40 views

Convert JSONPath back to JSON object [Javascript]

Using NPM: jsonpath to get all the JSONPath's matching an pathExpression from an JSON object. Something like "jp.nodes(obj, pathExpression)". Is there a way to construct back the JSON object from the ...
0
votes
0answers
39 views

Return a list of lists from JsonPath not a flattened list

Reading a path with nested components and arrays such as : $.['Item'].OuterCase[*].InnerCase[*].someProperty seems to always return a flattened list e.g [ someProperty1A, someProperty1B, ...
0
votes
1answer
55 views

Java create a new Json reading from another Json using jsonpath

In java (any library), starting from a json like the following (with nested fields, arrays and embedded documents): { "first" : "1", "second" : { "third" : "3", "fourth" : "4" }, "...
0
votes
2answers
31 views

AWS API Gateway only allows the first element of the form data and ignores the rest

I have been trying to push data into AWS SQS using AWS API Gateway, the data I send is in the form of application/x-www-form-urlencoded. And it looks somewhat like this: fruits[]: apple fruits[]: ...
0
votes
0answers
22 views

Deserialize and serialize JSON only to restructure it?

I want to restructure a JSON file. The way I am thinking is to deserialize and serialize back to JSON object using jackson and jsonPath. I will explain with an example: file1.json { v1: foo, ...
0
votes
1answer
35 views

JSONpath, only return result if other element has a value

I am looking for the JSONpath expression to extract elements in an array only if it contains another element. The following expression returns all elements; $.differ.element[*]['id','alias'] This ...
1
vote
1answer
68 views

JsonPath: filter by value in any array in array

I try to filter to get value from subscriberNumber inside "*..ou.subscriber" that have extendedinfo[SOURCE_OR_TARGET=="TARGET"], but my jsonpath its doesn't work. The jsonpath I try: $..ou[?(@....