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

Using JsonPath in Java (8) to create/add nodes and arrays

I am trying to create or update a JSON with a new key:value nodes inside a JsonArray. So far I am able to add simple values using a map of nodes, but I am unable to add an array. The goal is to create a JSON string with the following values: { …
Leon Proskurov
  • 135
  • 1
  • 14
0
votes
1 answer

Is there a way to interpolate OutputPath's JsonPath using state's input in AWS step function?

Basically, i have the following input: { "name": "abc", "choice": "choice1" } My dynamoDB table has the following structure: Partition key - "name" Complex json with choices: { "choices": { "choice1": ......, "choice2":…
ArielB
  • 1,184
  • 2
  • 11
  • 36
0
votes
1 answer

Asserting the values in array, array not having name

i'm trying to mock HttpMessageNotReadableException, below is the Junit 5 code. @BeforeEach public void setUp() { MockitoAnnotations.initMocks(this); this.mockMvc = MockMvcBuilders.standaloneSetup(controller).build(); } …
user2587669
  • 532
  • 4
  • 10
  • 22
0
votes
1 answer

jsonpath_ng.lexer.JsonPathLexerError: Error on line 1, col 8: Unexpected character: /

I am using jsonpath_ng library to build a jsonpath expression.But getting error while parsing expression as expression contains /. jsonpath_ng.lexer.JsonPathLexerError: Error on line 1, col 8: Unexpected character: / Tried…
Priyanka
  • 1
  • 3
0
votes
1 answer

Extracting values from JSON using JSONPath, excluding specific ones

I've got a JSON like that: [ { "accID": "3asdasd321asdasdfsadf2", "test": "one", "isGood": "true", }, { "accID": "Not Found", "test": "two", "isGood": "true", }, { "accID": "1asdasd121asdasdfsadf5", "test": "five", "isGood": "false", } ] And I want…
0
votes
1 answer

Oracle json path compound expression using multiple context does not work

I have the following json: { "signedOffTasks":[ "TASK2" ], "taskDeadlines":[ { "taskKey":"TASK1", "deadline":"2016-05-02" }, { "taskKey":"TASK2", "deadline":"2016-05-02" }, …
gabox01
  • 313
  • 2
  • 9
0
votes
0 answers

RestAssured: Assert Json response which has single object response fails due to not started with curly brace '{' or an openning square bracket '['

We have scenario where there is GET API call which extracts "excel" file data from file given file location in the GET call Body. Using: RestAssured with Cucumber BDD The Response comes as: "{\"('Test\/Test1',…
la1
  • 519
  • 1
  • 8
  • 30
0
votes
1 answer

Jmeter - JSON Extractor

I'm trying create a json expression path that returns the id when the reference with {" id ":" 00000000000000000000000004640254 "}. I have tried with $.[?(@.Relationship[?(@.Ref.id=='00000000000000000000000004640254')])].id but it doesn't return…
0
votes
1 answer

Parsing JSON into list of Java POJOs using JSurfer or similar

Java 8 here, trying to use the JSurfer library, however I will accept just about any efficient solution that works. I am being given a string containing (for example) the following JSON: [ { "email": "example@test.com", "timestamp":…
hotmeatballsoup
  • 385
  • 6
  • 58
  • 136
0
votes
1 answer

How to select fields in different levels of a jsonfile with jsonPath?

I want to convert jsonobjcts into csv files. Wy (working) attempt so far is to load the json file as a JSONObject (from the googlecode.josn-simple library), then converting them with jsonPath into a string array which is then used to build the csv…
Voß
  • 103
  • 9
0
votes
1 answer

SOAPUI did not match jsonpath in multi dim array

I tried to match jsonpath assertion in SOAPUI 5.5.0 with the following statement: $.root[*][?(@.id==1)].updates expected = 2 response to test: { "root": [ [ { "id": 2, "title": "hello world", "kind": "post", "updates":…
0
votes
1 answer

How to insert empty string in DynamoDB using the output of a Lambda in Step Functions?

I'm trying to save the output of a Lambda which calls Lex to DynamoDB using Step Functions. The intentName in a Lex response is sometimes null (unknown). The problem is that in the state (task) that saves the response to DynamoDB, because of this…
0
votes
1 answer

Extract element from json object array

I have below json response. Below response for layer2 object array there can be x number of items {"data": { "layer1": { "layer2": [ { "item1": "result1", "item2":…
Shabar
  • 2,617
  • 11
  • 57
  • 98
0
votes
1 answer

How to remove the json key value with JSonPath in java

I know it could be a duplicate, but still posting my question as i could not find the exact answer what i am looking for. I am having an json object (or string) like below. String str = "{ "status" : { "timestamp" : "2020-04-30T01:00:00…
mmar
  • 1,840
  • 6
  • 28
  • 41
0
votes
1 answer

JsonPath (jayway) to return scalar as array

I have struggles to craft working jsonpath (Jayway https://jsonpath.herokuapp.com/) where property (scalar) is returned as array. For input { "a":{ "b":"valueofb" } } I would like obtain array: ["valueofb"] NOT just valueofb
Cron Merdek
  • 1,084
  • 1
  • 14
  • 25