Questions tagged [jmespath]

JMESPath (JSON Matching Expression paths) is a query language for JSON. JMESPath allows you to extract elements from a JSON document. It also allows you to directly transform the queried elements.

JMESPath (JSON Matching Expression Paths) is a query language for .

In addition to allowing you to extract elements from a JSON document, it also allows you to transform the queried elements.

In other words: JMESPath is to JSON what is to .

For questions about JSON itself, please use the tag.

Useful Links:

495 questions
1
vote
1 answer

jmespath Select arrays only if they contain specific value

I have this JSON as input: { "users": { "alpha": [ "read", "annotate", "write", "delete", "manage" ], "beta": [ "read", "annotate", "write", "delete", "manage" ], …
1
vote
2 answers

JMESPath filtering on response

I try to filter to get lldp-remote-system-name when lldp-remote-system-name contains slc1. But I get the error: Error in jmespath.search in json_query filter plugin:\n'in ' requires string as left operand, not NoneType Tasks: - name: get system…
jlast
  • 49
  • 5
1
vote
0 answers

Query expression with aws policy query

Getting response back from AWS CLI call: aws sns get-topic-attributes --query 'Attributes.Policy' gives me the whole policy. I would like to query specifically on one policy statement, by value of the Sid. I Have tried: --query "[Attributes.Policy…
Danielle
  • 53
  • 4
1
vote
1 answer

Gatling check every value in array

I am writing gatling tests and using JSONPath $..parentId. I am getting the response: [ "102044", "102044", "102044" ] I want to check that every value is equal to 102044. The amount of values can change. By now I'm checking only random…
1
vote
2 answers

Filtering at start of query breaks filtering at end of query

This is my JSON: { "items":[ { "fieldone":"sdfsdfsdfsdf", "fieldtwo":{ "subfieldTwo":{ "aaa/bbbb":"test-app-one" } }, "fieldthree":{ "subfieldThree":[ …
red888
  • 27,709
  • 55
  • 204
  • 392
1
vote
0 answers

How to convert key's value from dictionary to a new key in JMESPath?

How to achieve following using JMESPath? Input: [ {"letter": "A", "word": "Apple"}, {"letter": "B", "word": "Ball"}, {"letter": "C", "word": "Cat"} ] Expected Output: [ {"A": "Apple"}, {"B": "Ball"}, {"C": "Cat"} ] I have tried…
Sachin Dangol
  • 504
  • 5
  • 13
1
vote
1 answer

extract data with json_query from jinja2 variable in ansible

I have a variable in the inventory that contains a JSON formatted data. I want to extract a specific part of the data with json_query. The variable contains a list of domains with related IP addresses (the JSON is valid): DOMAIN={"domain1.net":…
1
vote
2 answers

jmespath how do I find the key values in the dictionary?

I have an example json file. I need to extract all the values of the downloadUrl keys: { "nodes": { "children": [ { "id": "", "localizedName": "", "name": "Documents", "children": [ { …
user461101
  • 25
  • 5
1
vote
1 answer

How do I do a contains expression in a nested object?

this is my json { "items": [ "top": { "first": "test", "second": { "third": "test", }, ... This returns all items where top.first contains test: items[?contains(top.first, `test`)] This returns an…
red888
  • 27,709
  • 55
  • 204
  • 392
1
vote
1 answer

remove null elements from list ansible

Below is my JSON file: [ { "?xml": { "attributes": { "encoding": "UTF-8", "version": "1.0" } } }, { "domain": [ { "server": [ { …
Ashar
  • 2,942
  • 10
  • 58
  • 122
1
vote
1 answer

jmespath extract a key from a list which is not json

I am trying to extract a piece of text from a list. The list is something like this [{'texts': [{'language': {'isoCode': 'it', 'name': 'Italian'}, 'text': 'CATETERI VENOSI CENTRALI CON ACCESSO PERIFERICO MULTILUME', 'allLanguagesApplicable':…
jhon.smith
  • 1,963
  • 6
  • 30
  • 56
1
vote
2 answers

AWS CLI JMESPath Query help using query option in cli

I have the following cli command aws ecs list-services --cluster ecs-cluster-1 Giving this JSON { "serviceArns": [ "arn:aws:ecs:us-east-1:XXXXXXXXXXXXX:service/ecs-cluster-1/app4", …
Jeetendra Pujari
  • 1,286
  • 2
  • 17
  • 31
1
vote
0 answers

jmespath - find a key wherever it is

I have a very large json and I don't want to access a key with a very long filter (ie: a.b.c.d.e.f.g.key1). In the path there are not only scalar objects but also list. Is there a way to write a filter in order to find a key wherever it is? { "a": {…
Riccardo79
  • 954
  • 4
  • 17
  • 35
1
vote
1 answer

PromTail JSON Scrape Special Character

For a PromTail scrape config, I am using a JSON stage. I have a JSON log that looks like this: { "@l": "info", "foo": "bar" } I am looking to use the JSON stage to extract the @l property into the map. I tried this: - json: expressions: …
Gabe
  • 49,577
  • 28
  • 142
  • 181
1
vote
1 answer

Sorting partially missing arrays with jmespath

I am trying to sort this source data outeractivities by outer_name and, then, activities by and inner_name: Sourcedata.json: [ { "outeractivities": [ { "outer_name": "2" }, { …
Wibbico
  • 15
  • 4