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

How I can select object by name with JMESPath?

How to extract an element from JSON file by element name? For example what I have in the ansible-playbook: - debug: msg: "{{ test }}" This is output (my file) ok: [test] => { "msg": [ { "element1": { …
Veneomin
  • 31
  • 3
1
vote
2 answers

Using Key(@) function to extract keys from an object in Ansible

I have a file file.sub which contains this JSON object {"kas_sub.test1": "true", "kas_sub.test2": "true"}. I would extract the keys and to get this: kas_sub.test1 kas_sub.test1. When i try - shell: 'cat path/to/file.sub' register: file1 - debug: …
medisamm
  • 197
  • 1
  • 7
1
vote
0 answers

JMESPath export keys based on value from JSON object

I'm trying to filter simple JSON data and export keys with similar values using the JMESPath query. This is my JSON. { "af": "0", "al": "2", "dz": "0", "ad": "2", "ao": "1", "ag": "2", "ar": "2", "am": "2", "au": "3", "at":…
DaftPlug
  • 60
  • 1
  • 10
1
vote
1 answer

How do I merge objects within array in JMESPath?

How can I merge objects within array? { "input": [ { "company_name": "Test", "property_space": 151821 }, { "company_name": "Test", "property_space": 145236 } ] } I want to get an output like this { …
Nurzat
  • 11
  • 2
1
vote
1 answer

JMESPath --query filter for an unusual array (dictionary), anyone up for a challenge?

As you can see the picture below. I want to filter descriptor value where subjectkind is group. The azure CLI command I am using to get the descriptor is az devops security group membership list --id $var1 --org https://dev.azure.com/$OrgName/…
1
vote
1 answer

How can I get attribute valus of a JSON using JMESPath

I need to get the value of _ISSUE_CURRENCY. I have a JSON which is as below: { '#value': 'VR-GROUP PLC', '_ISSUE_CURRENCY': 'EUR', '_PRICING_MULTIPLIER': 1, '_TYPE': 'Debt', '_SETTLEMENT_CALENDAR_ID': 'Tgt', '_SUBTYPE':…
Bruno Lorena
  • 73
  • 1
  • 9
1
vote
2 answers

How to get the name of component at which stepfunction has failed

I have list of executionArn of stepfunction execution, I am filtering those executionArn by status == 'FAILED'. Now, how can I get the exact failure of the stepfunction in Python, (meaning: at which point the execution has failed)?
1
vote
1 answer

Update JSON object using JMESPath

Can JMESPath be used to update the JSON object? A new attribute needs to be added to people.data as "field1": "value1" { "people": [ { "age": 20, "other": "foo.aaa", "name": "Bob", …
Devi
  • 73
  • 1
  • 7
1
vote
2 answers

JMESPathError in json_query filter: Unknown function: regex_search()

Here is my playbook: - hosts: localhost vars: { "result": [ { "_ref": "vlan/ZG5zLnZsYW4kLmNvbS5pbmZvYmxveC5kbnMudmxhbl92aWV3JElORlJBTEFCLjEuNDA5NC4xMQ:LAB1/test1/11", "id": 11, …
netv
  • 165
  • 2
  • 12
1
vote
2 answers

AWS CLI --output text on a single line of first and second level json

I am trying to get a list of certificates (let's say 100) from AWS Certificates Manager with their Domain Name, Expiry Data, Validation Status and Validation Method with the aws cli command aws acm describe-certificate. I tried nesting filtering and…
YAZ84
  • 43
  • 7
1
vote
1 answer

Filtering nested arrays and selecting specific properties using az cli JMESPath

I am trying to query a response from the following az command: az provider operation show --namespace Microsoft.KeyVault I want to query all operations that relate to secrets to be able to build a custom role for a RBAC enabled key vault. This is a…
jokarl
  • 1,913
  • 2
  • 24
  • 52
1
vote
1 answer

Pass JSON from output for another query Ansible

Please help me figure out what I'm wrong with. I'm getting a JSON from Ansible and filtering it, after which I want to save the output and reuse it. But, unfortunately, I get an error that this attribute does not exist. Where did I go…
1
vote
1 answer

Filter list of dictionaries by nested attributes

I have the current list I'd like to filter by type=orange: my_list = [{'anotherfieds': 'aaa', 'fruits': [{'tastes': 'good', 'type': 'orange'}, {'tastes': 'bad', 'type': 'apple'}], 'name': 'A'}, {'differentfield': 'bbb', 'fruits':…
DominiCane
  • 1,263
  • 3
  • 16
  • 29
1
vote
1 answer

How to filter using Tags for RDS DB Snapshots

I want to filter Automated RDS DB Snapshots based on tags using AWS CLI. Since AWS does not support directly to filter tags, I tried below cli commands but I get stuck while filtering it. Below cli is to get the snapshots which are 30 days…
Alfred
  • 73
  • 1
  • 7
1
vote
1 answer

How to get list of values of same key from a JSON using JMESPATH

I have the following JSON object, [ { "name" : "a1", "value": null }, { "name" : "a2", "value": 3, } { "name" : "a1", "value": 4 }, { "name" : "a2", "value": 6 } ] I want a…