Questions tagged [json-path-expression]

A JSON path expression is an expression, possibly in a domain-specific language, specifying a path to to one or more values within a JSON text. The expression may include filters.

Javascript provides a well-known notation for JSON path expressions. JSONPath and JMSEPath are well-known DSLs for JSON path expressions. In jq, any JSON array consisting solely of strings and/or integers can be used as a path expression.

179 questions
0
votes
1 answer

Retrieve consecutive array element from an array using JSONPath without using index, only by their value

I have a json body as below - { "type": "SourceUnit", "children": [ { "type": "PragmaDirective", "name": "solidity", "value": ">=0.4.22 <0.9.0" }, { "type": "ContractDefinition", "name": "txorigin", …
0
votes
1 answer

Apply filter to an entity within an object using JSONPath

I have the following JSON: { "value": { "activate": false } } I want the JSONPath value to returned as true, but on applying the filter as below: $.value.?(@.activate==false) I get an invalid result. Is there anything wrong with the JSONPath?
0
votes
1 answer

Is it possible to get line number based on JsonPath for a given Json?

I have a JSON like below, and have JSONPath like for example, "$[0].child_members[7].diamond.diamond_id" => Line number 55 "$[1].match_departments[0]" => Line number 83 I want to find the line number for JSONPath in corresponding JSON. I am using…
Ankit Ostwal
  • 1,033
  • 3
  • 14
  • 32
0
votes
1 answer

How to make SelectTokens() select root element if jsonpath expression evaluates to true

So I'm working with some token filtering at the moment, and have a situation where I need to filter tokens based on the filter condition in C# using the SelectTokens() method, with the catch that if a single value matches the query, I want all…
A Sad Shoe
  • 134
  • 6
0
votes
2 answers

JSONPath: Get root array object using filter of child value

Im trying to get JSONPath expression to filter my JSON and get whole sport object using value of child array. I have following JSON: [{ "name": "Soccer", "regions": [{ "name": "Australia", "leagues":…
0
votes
1 answer

How to write an exists predicate for jsonpath in Apache Camel?

In my Apache Camel application I have multiple conditions checking the existence of keys in a JSON. I want to reduce the boiler plate code, therefore I need to transform my Expressions to a Predicate. My code with Expressions: .choice() …
dur
  • 15,689
  • 25
  • 79
  • 125
0
votes
2 answers

How to cross reference a property in JMESPath or JSONPath?

I am trying to use jmespath for my querying my json and I am trying to access a property which is at a higher level. Below is my JSON: { "properties": { "DefaultVMTypeID": "RT", "VM": { "measurements": [ …
Ankit Tanna
  • 1,779
  • 8
  • 32
  • 59
0
votes
1 answer

escape forward slash in jsonpath

I'm trying to write a simple JSON path query oc get pa -o jsonpath='{range.data[*]}{@.data.vpa.pa\.poc\.hpa\\/value}{"\n"}{end}' "data" [ { "vpa" { "pa.poc.hpa/value" : 20 } } ] from above JSON trying to get 20 …
kiran k
  • 41
  • 8
0
votes
2 answers

data co-occurrence in JSON dataset

I'm having trouble extracting JSON information. My JSON file contains 100 chapters of a novel. Each chapter contains a number of characters found in the chapter. For instance: {"ONE": ["PERSON A", "PERSON B", "PERSON C", "PERSON D", "PERSON…
0
votes
1 answer

Postgres jsonb_path_query to filter sub-arrays by their length

In Postgres 13.3, I'd like to extract sub-arrays of a particular length from a jsonb value: select jsonb_path_query('[[0,1], [0,1,2]]'::jsonb, '$[*] ? (@.size() >= 3)'); However, this returns nothing (0 rows). What am I doing wrong? Note that I'd…
Meglio
  • 1,646
  • 2
  • 17
  • 33
0
votes
0 answers

Json Path logical NOT operator with Filter not working

I have JSON data and want to use the logical not operator in JSONPath, however, I want to use it dynamically since my input string consists of many filters which I convert into a JSONPath query. v1/movie?filter=not metadata.sample eq "NETFLIX" this…
0
votes
1 answer

How to write JSON Path to get particular value based on string filter?

I am new to JSON Path and I am trying to get 'id' corresponding to name='Candy' using JsonPath in below JSON payload. { "responsePayload": [ { "content": { "id": "101", …
Nvdp
  • 3
  • 1
0
votes
1 answer

using jsonpath-plus to filter the value

Json is { "value": [ { "resourceType": "virtualMachines", "name": "Standard_B1ms", "capabilities": [ { "name": "MemoryGB", "value": "6" }, { …
0
votes
2 answers

ADF - Data Flow- Json Expression for Property name

I have a requirement to convert the json into csv(or a SQL table) or any other flatten structure using Data Flow in Azure Data Factory. I need to take the property names at some hierarchy and values of the child properties at lower of hierrarchy…
0
votes
1 answer

RestAssured - want to verify the body structure of JSON response in RestAssured

When i request for GET request, I'm getting the JSON response, but here my requirement is to validate the structure of response body. For example: { "lotto":{ "lottoId":5, "winning-numbers":[2,45,34,23,7,5,3], "winners":[ …