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
2
votes
2 answers

JSONPath: Extracting subset of array produces weird results

I have this json: { "push": { "changes": [ { "commits": [ { "hash": "b194ab92186b94de3f9493818c353e9bbedb38d4" } ] } ] } } And, I have the follow jq, code that works…
Christian Bongiorno
  • 5,150
  • 3
  • 38
  • 76
2
votes
1 answer

Python, jsonpath_ng: Exception: Parse error at 1:4 near token ? (?)

How do I get a specific list of information from JSON through text field input? Here is my sample JSON data (retrieved via URL). Actually, there are hundreds of items. { "items": [ { "timestamp": "2020-04-03T23:24:27+08:00", …
Jason Kyaw
  • 21
  • 1
  • 2
2
votes
1 answer

NiFi EvaluateJsonPath array length

I have the following JSON: { "hits": { "hits":[] } } (Some response from ElasticSearch). I want to use the processor EvaluateJsonPath to get the length of hits.hits. I tried the following expression: $.hits.hits.length But I get…
ChikChak
  • 936
  • 19
  • 44
2
votes
1 answer

Kubectl JSONPath expression to obtain cluster.server property based on current-context

I'd like to use kubectl with only jsonpath to obtain the current cluster address. I've tried the following, and many permutations of it, but this doesn't seem to work. kubectl config view -o…
cewood
  • 1,011
  • 8
  • 11
2
votes
0 answers

How to set null JSON values as JMeter variables

For a given sample JSON (this is only an example, the real JSON is much larger): { "username":"Admin", "text":"test message", "attachments":[ { "title":"demo server", "title_link":"${link}", "text":"sample text", …
Mate Mrše
  • 7,997
  • 10
  • 40
  • 77
2
votes
2 answers

JMeter - JSON Extractor extracts correct value in one case but null in other case

I have two requests that return response with similar JSON structure. When I try to use JSON extractor on one, it works properly but when I try to extract value in the same way from the second one, it doesn't work. But let's cut to the chase. My…
Alice M
  • 21
  • 2
1
vote
0 answers

JSONPath - How to get value from specific element of matched array

Let's say I have this JSON: { "toplevel": [ { "testval": "accept", "number": 1 }, { "testval": "reject", "number": 2 }, { "testval": "accept", …
David Ranney
  • 59
  • 2
  • 11
1
vote
1 answer

DEFAULT_PATH_LEAF_TO_NULL in jsonPath not working

JSON { "abc": { "country": [ { "city": "JODHPUR" } ] } } JSONPath Configuration private static final Configuration suppressExceptionConfiguration = Configuration .defaultConfiguration() …
SRJ
  • 2,092
  • 3
  • 17
  • 36
1
vote
1 answer

What counts as an object vs a string in Typescript?

I am creating a Infrastructure-as-Code for a Step Functions Machine. One of these states is of type 'Task' which performs a DynamoUpdateItem on a DynamoDB table. The code looks as following: const updateDDB = new tasks.DynamoUpdateItem(this,…
1
vote
1 answer

How to filter elements by node key in JSONPath?

What I want Apply a JSONPath to given json response, to match specific elements by comparing their children's node keys with a value. Input { "data": { "ticket": { "1": "foo", "2": "bar", "3": "baz" …
oikonomopo
  • 4,025
  • 7
  • 44
  • 73
1
vote
0 answers

Does AWS MemoryDB supports Redis Search?

I'm planning to use AWS MemoryDB for reading and filtering out data from my JSON document using JSON commands https://docs.aws.amazon.com/memorydb/latest/devguide/json-document-overview.html I was able to perform search operations and get back data…
1
vote
1 answer

Get the root key with jsonb_path_query()

In Postgres 13, for the below query, the jsonb values are getting filtered correctly based on "priority": SELECT jsonb_path_query( '{ "100": { "name": "test", "priority": 5 }, "101": { "name": "test2", "priority": 10 }, …
1
vote
1 answer

JSONpath to return specific keyed objects from an array

using jsonpath (https://www.npmjs.com/package/jsonpath) to query an array of objects. I would like to return specific keyed objects from a nested array. Data: [ { "payload": { "data": { "battery": { "name": "Battery", …
pb46
  • 13
  • 3
1
vote
1 answer

Extracting a JSON out of a string using JSONPath

I have Json data as follows: { "template" : [ "{ "Id": "abc" }" ] } I am using JSONPath to extract data from the Json above. I would like to extract the "Id" data from the Json using JsonPath. The problem I see is, the…
mang4521
  • 742
  • 6
  • 22
1
vote
1 answer

How to use a path with nonNull check in an array using JSONPath

I have a simple json like { "store": { "book": [ { "category": "reference", "author": "Nigel Rees", "title": "Sayings of the Century", "price": 8.95 …
Metalhead
  • 1,429
  • 3
  • 15
  • 34
1
2
3
11 12