Questions tagged [jsonpath]

1

votes
2

answer
80

Views

Is there any languages for querying CBOR?

I'm looking for a languages for querying CBOR, like JsonPath or jq but for CBOR binary format. I don't want to convert from CBOR to JSON because some CBOR type is not existed in JSON, and performance issue.
Phạm Văn Thông
1

votes
1

answer
1.5k

Views

How to pass content type “application/x-www-form-urlencoded” with rest assured

I am trying to hit API using Rest assured which is a POST request with form param client id, user and password. and multiple header . I am getting 415, unsupportted media type error. My code is: Response res = given(). .header('Accept', 'application/json') .header('Content-Type', 'application/x-...
itin
1

votes
0

answer
122

Views

Standard EBNF grammar of JsonPath

I wan't to implement my own JsonPath library but I can not find standard definition of its grammar. I found https://github.com/kevinbirch/kanabo/blob/master/jsonpath.ebnf but it look like much more complicated. Where can I find the complete version of JsonPath grammar?
Phạm Văn Thông
1

votes
0

answer
25

Views

JSONPath : preserving contents at filtered values

Below is the JSON content on which I was trying to extract the contents of matched filters { 'results': [{ 'individualProviderId': 'P1', 'locations': [{ 'addressInfo': { 'city': 'Pembroke Pines', 'county': 'Broward', 'state': 'FL', 'zip': '33026' }, 'plans': [{ 'networkId': 'N1', 'tiering': [{...
Syed Mazreena
1

votes
0

answer
513

Views

JSON Path - get count of array

Here's my sample JSON - { 'store': { 'book': [ { 'category': 'reference', 'author': 'Nigel Rees', 'title': 'Sayings of the Century', 'price': 8.95 }, { 'category': 'fiction', 'author': 'Evelyn Waugh', 'title': 'Sword of Honour', 'price': 12.99 }, { 'category': 'fiction', 'author': 'Herman Melville',...
tempid
1

votes
1

answer
223

Views

Combine two objects using JsonPath

Suppose I have json like this: [ { 'a': 1, 'b': 2, 'c': 3, }, { 'a': 1, 'b': 2, 'd': 4 } ] Is it possible to write a JsonPath which will give me: { 'a': 1, 'b': 2, 'c': 3, 'd': 4 } The order of the elements in the list is not sure, however the element names I know beforehand. So I thought I could us...
Semi
1

votes
1

answer
554

Views

How to find key from value in rest assured java?

I am using rest assured java and i am using post request in order to get the response. From my code i am able to get the response and i am seeing that in response i am seeing that value which i want to store is present in the keyset. Here is the example: { 'status_code': 200, 'status_message': 'OK',...
Ashwajeet Gajre
1

votes
1

answer
142

Views

Is it possible to have virtual column in HSQLDB

I am new to HSQLDB and I am not sure whether HSQLDB supports Virtual column and JSON Path. I am trying to make use of this database to run my Unit Testing. We use Oracle as the actual database and the Oracle Table has one field which accepts JSON as CLOB. Using JSON Path feature in Oracle, we have...
bhuvanit86
1

votes
0

answer
181

Views

JSONPath unable to parse when expression contains hyphen

I am using codeception for testing my JSON API laravel project. I am using codeception's JSONPath functions to check the structure of the responses. I am unable to parse the expression when it contains a hyphen. Json Path uses hyphen as a subtraction operator, but in this case I have used it as a st...
aimme
1

votes
1

answer
230

Views

JSON SelectToken Path Either Too High (Parent) or Too Low (Child) For Values I Want

I'm querying the DellAPI at https://sandbox.api.dell.com/support/assetinfo/v4/ to get the end date of extended onsite support warranties as a .NET object. But I'm having trouble defining my SelectToken path to work with the JSON result from Dell. Here's the relevant bit of code I'm using (sans the d...
CyborgHobbit
1

votes
0

answer
49

Views

Assert status via jsonpath

I would like to add a monitor to detect unhealthy service and sending alert in that case. I've expose a simple REST API - /healthy which returns a JSON e.g. {'healthy': true}. Then I've added a REST API Monitor to my site24x7 account, set the content checks response format to JSON and now I should...
Ami Hollander
1

votes
1

answer
587

Views

How to compare two jsonPath values in MockMvc

I am writing tests for my spring application using MockMvc. Assume that my json result will have the following format: { 'available': true, 'location': [ {'ID': 1, 'path': 'local1'}, {'ID': 2, 'path': 'local2'}, {'ID': 3, 'path': 'local3'} ], 'firstItem': 'local1' } And I would like to test that if...
Ock
1

votes
0

answer
108

Views

JSON Path throwing file not found exception even when configuration is set to Option.DEFAULT_PATH_LEAF_TO_NULL

I have a JSON input as follows: [ { 'id': '1', 'name': 'Test', 'location': { 'address': 'Street 1', 'crossStreet': 'Street 2' } }, { 'id': '2', 'name': 'Test' } ] where the location information is optional. So I have set Option.DEFAULT_PATH_LEAF_TO_NULL to my JSONPath configuration variable. However...
user3243499
1

votes
0

answer
1.1k

Views

Is JPath the same as JSONPath?

Although the names look similar, small changes could be tricky. Unfortunately I cannot find decent info about JPath. The docs of JSON.NET are talking about JPath and JSONPath and I think there are the same. Am I correct? A String that contains a JPath expression. from JToken.SelectToken This sampl...
Julian
1

votes
0

answer
24

Views

How set Custom path to browse & view content of it?

In this code for file manager script I want to set the custom or optionality path/directory to view his folders and files. So, how can I do that ? function get_absolute_path($path) { $path = str_replace(['/', '\\'], DIRECTORY_SEPARATOR, $path); $parts = explode(DIRECTORY_SEPARATOR, $path); $absolu...
1

votes
0

answer
107

Views

Pass multiple InputPaths to a StepFunctions Task

While invoking a state's task, is it possible to specify multiple InputPaths, or 'pick' more than one JSON nodes to be passed to the task's input ? Example: If this is the execution input: { 'id':'identifier', 'nestedObjectA': { 'doubleNestedObjectA': { 'valueA': 'value' } }, 'nestedObjectB' : { 'va...
user7172184
0

votes
0

answer
3

Views

JsonPath Path Not Found Exception While Data Driving From Jsonfile So As To Randomize the data

Is there a Issue to use below code,basically data driving from Jsonfile ,I am creating random numbers below that is eventidStart and eventidEnd are fetching their respective values from Json file which is shown below var idNumbers=(eventidStart to eventidEnd).iterator def eventidStart: Int = JsonP...
Tk infostrings
1

votes
0

answer
35

Views

Converting xml input into json format with skipping parent keys but coping its values to childs

I must convert XML document to JSON format with skipping specified keys and appending its values to parents. I'm forced to use Java 7. For example I have following XML and I must skip 'message' elements: 1 2 3 4 Expected output is: { 'messages' : [ 1, 2, 3, 4 ] } I'm using XML.toJSONObject(xmlInput...
mtw
1

votes
0

answer
35

Views

How to specify alternative json path for a element that might have two different types

Consider following situation for call field in phoneNumbers array, it can have object or string as a value. Basically I want to be able to say either get me Prefix value OR whatever string value there is in field call { 'firstName': 'John', 'lastName' : 'doe', 'age' : 26, 'address' : { 'stree...
VishalDevgire
1

votes
0

answer
91

Views

Complex json validation with JsonPath

Im trying to validate the below json using Jsonpath. I am not able to validate any values after the 'fieldMap'. I get No JSON path error on everything that I tried. Please advise on how to validate the json string. { 'Identifier': 'ABC#SOMEYNC001#112#2018071900:00', 'someEventId': 'Some001', 'Error'...
emjay
1

votes
0

answer
62

Views

Using JSONPath to exclude nodes

Is it possible to use JSONPath to exclude nodes? For example, given the following variable { 'store': { 'book': [ { 'category': 'reference', 'author': 'Nigel Rees', 'title': 'Sayings of the Century', 'price': 8.95 }, { 'category': 'fiction', 'author': 'Evelyn Waugh', 'title': 'Sword of Honour', 'pri...
Amy
1

votes
1

answer
130

Views

A json transformation as simple as xslt / saxon

I'm working on an 'Extract Transformation Load' project. In my previous ETL projects, the dataload was structured in XML and I was using xslt for the Transformation part. For this project, the data is in JSON. Is there a convenient way to convert one json file into another json file, using jsonpath...
Bepeho
1

votes
0

answer
64

Views

Java JsonPath: modify multiple JSON attributes at once

I am struggling to modify several JSON objects, while using the JsonPath library. I have a selector, that gets declared at runtime and a JSON file of unknown size. I want to only modify the JSON objects, that match the filter’s criteria defines by the selector. In this example, all objects get a n...
Jonas_Hess
5

votes
0

answer
32

Views

Access JSON::Path numbers only key

What is the correct syntax to acces a json key that does only has numbers with Perl6 Module JSON::Path? I'm getting 'JSON path parse error at position 6' erros. I would like to access items->2018->name: use JSON::Path; my Str $json = 「 { 'items' : { 'old' : { 'name' : 'olditem' }, '2017' : { 'na...
Valle Lukas
1

votes
0

answer
29

Views

Search for RestASSURED values by sending a variable

In the following code fragment I am trying to find in my responseBody a specific number by a variable and thus save its brother value. However when I try to do it that way he answers me null and if I remove the quotes he answers me: The parameter 'n0' was used but not defined. Define parameters usin...
edwin romero
1

votes
2

answer
358

Views

How to read a JSON file into a Map, using Scala

How can I read a JSON file into a Map, using Scala. I've been trying to accomplish this but the JSON I am reading is nested JSon and I have not found a way to easily extract the JSON into keys because of that. Scala seems to be wanting to also convert the nested JSON String into an object. Instead...
djangofan
1

votes
0

answer
89

Views

create a json path expression to get all the specific child elements, excluding the first parent

my json is as follows: { 'a':[ { 'x':'1' }, { 'x':'2' }, { 'x':'3' } ], 'b':[ { 'x':'4' }, { 'x':'5' } ], 'c':[ { 'x':'6' }, { 'x':'7' } ] } i know i can get all the x's by $..x but i do not want all x's. i am trying to avoid getting the values of x from first array that is 'a'. basically get all x'...
fff
1

votes
0

answer
47

Views

Jayway JsonPath .. equivalent in Gpath

I would like to fetch all embedded json elements but I could not make it working. Let's say I would like to filter all b's here. What gpath syntax to filter all b's here? { a:{ c: { b:1 } b:45 d: { b:444 } } I can use $..b in Jayway, but, how shall I use it for Groovy Gpath. I'm working with Rest-A...
CMM
1

votes
1

answer
155

Views

Oracle JSON Array query

My version: Oracle Database 12c Standard Edition Release 12.1.0.2.0 - 64bit Production CREATE TABLE DUMMY1 (id int NOT NULL PRIMARY KEY, doc1 VARCHAR2 (200) , doc2 VARCHAR2 (200), CONSTRAINT dummy_json1 CHECK (doc1 IS JSON) , CONSTRAINT dummy_json2 CHECK (doc2 IS JSON)); INSERT INTO DUMMY1 VALUES (...
Jidong Xin
1

votes
0

answer
42

Views

How to get the first value of a filtered JSONPath output

Below is the sample json that I used to get data based on string search using JSONPath. { 'tool': { 'jsonpath': { 'creator': { 'name': 'Jayway Inc.', 'location': [ 'Malmo', 'San Francisco', 'Helsingborg' ] } } }, 'book': [ { 'title': 'Beginning JSON', 'price': 49.99 }, { 'title': 'JSON at Work', '...
Vidyasagar
1

votes
0

answer
213

Views

Matching object in JSON with jsonpath in Spring Boot Test

I'm trying to write unit tests for a rest endpoint with Spring Boot Test that's going well but when I try to assert on an object in the json response with jsonPath an AssertionError is thrown even when contents are identical and the same. Sample Json { 'status': 200, 'data': [ { 'id': 1, 'placed_by'...
Enoobong
1

votes
1

answer
48

Views

Parsing a .json file (java). trying to get the item from the file, the result is null

Need some help with java+json. My question is about the .json file. When parsing a file, I get null value. There may be a problem in the file itself, or i'm using the wrong parsing path. I have a class PhotocameraDTO: import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterx...
YanaKit
1

votes
0

answer
90

Views

Fetching an Array inside JsonArray for JSON PATH

My JsonBody is { 'acr_values':[ 'AAL1', 'AAL2' ], 'poc':[ { 'attribute1':'value1' }, { 'attribute1':'value2' } ] } I'm trying to fetch the attribute acr_values as Array, As I'm expecting Array with in the Json Array as [ ['AAL1','AAL2'] ] and wanted to validate it using this snippet. Obj...
krishviews
1

votes
0

answer
61

Views

JSON - Setting field value inside all array elements

I have a JSON like the below one. store.book[*].author[*].share I need to update the share value with (current value+10). If share value is 9.2, then the updated value should be (19.2). The new value can be a complex logic also. So, basically get the current value and update the new value based on...
user1578872
1

votes
1

answer
221

Views

How to concatenate constant string with jsonpath

I have AWS step machine and one of the step is used to notify failure using SNS service. I want to select some metadata from input json into outgoing message. So i am trying to concatenate constant string with jsonpath like below 'Notify Failure': { 'Type': 'Task', 'Resource': 'arn:aws:states:::sns:...
LP13
1

votes
2

answer
32

Views

Getting assertionError using restassured on Json repsonse field value and the expected and actual are identical

Here is my code after getting the response. response.then().assertThat().body('documents[0].items[0].price.sales_tax_summary[0].rate',equalTo('0.0')); here is the response log: { 'id': 'quote-1', 'documents': [ { 'id': 'document-1', 'items': [ { 'id': '2', 'price': { 'amount_inclusive': 200000.5, 'a...
Omar Sabha
1

votes
0

answer
61

Views

How to extract field from JSON file with Gatling

I'm new in Gatling and Scala. I'm trying to write scenarios to test an API and do some http requests. I have a JSON file with an array of object. I'd like to extract the ID field in order to achieve an http request with it (multiple get). I'm trying to use feeder, i'm not sure about how it's working...
Yoann
1

votes
0

answer
24

Views

expectBody(“”, is(2)) vs expectBody(is(2))

I was expecting this 2 invocations to produce the same result, however I'm getting different results. expectBody('', is(2)) // empty path expectBody(is(2)) // no path My context is too big to copy here, but I got this example from the documenation. I'm using expectBody as shown here. However withou...
Roberto Morávia
1

votes
1

answer
97

Views

Use of Jayway JsonPath with Jackson

I have been using JsonPath. However after an issue yesterday where I discovered that the default JsonSmartJsonProvider didn't report an error with an invalid document at parse time, I modified my setup to use Jackson as below public JsonPathExtractor(String document) throws DocumentFormatException...
ceepan
1

votes
0

answer
36

Views

com.jayway.jsonpath.InvalidPathException: Space not allowed in path

I'm using JsonPath to check matches of some json-paths against a JSON document with a SpringBoot application. It gives the following exception when I include in operator inside the expression. But the same jsonpath expression works fine online. I tried debug inside jayway code as well but had no l...
Bhanuka Withana

View additional questions