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
0
votes
1 answer

JMESPath descend in tree for filter

What I'm trying to achieve I want to extract the volume ID for the root block device using describe-instances. What I tried so far aws ec2 describe-instances --filters "Name=tag:Backup,Values=True" --query 'Reservations[].Instances[].{Name:…
Yaron
  • 1,199
  • 1
  • 15
  • 35
0
votes
1 answer

Eliminate an Element from an AWS CLI Response

NOTE: I'm actually attempting this in Python and the Boto3 library, but I'm going to use the AWS CLI to explain what I'm trying to do. I'm making a list-object-versions call to my bucket in AWS... aws s3api list-object-versions --bucket…
grbonk
  • 609
  • 6
  • 22
0
votes
2 answers

JMESPath query expression with value range

I have the below json that has a range. I am trying to get values from json for a specific entry from the range to be used as an ansible variable . for instance i would like to get the folder value of of server002 from below json to be used as an…
Vijayendar Gururaja
  • 752
  • 1
  • 9
  • 16
0
votes
1 answer

jmesPath query lookup help. Is this query right?

I have this JSON object: { id: { name: "BBCommercialPropertyStructureFloodCoverage", }, carrierData: null, link: [ { key: "Location", select:…
Jwan622
  • 11,015
  • 21
  • 88
  • 181
0
votes
1 answer

JSON query for finding the newest snapshot for host and device?

I am trying to find the newest snapshot for a device and host in AWS with the aws ec2 command. I am getting the following output from aws ec2 describe-snapshots. As you can see I can have several snapshots for the same host (see Tags with Keys…
Tony Stark
  • 2,318
  • 1
  • 22
  • 41
0
votes
1 answer

JMESPath: In a dict combine an array value with a scalar value to get a list of the cross products

is there some way to achieve the following behaviour in JMESPath? I have a dict like this: { "foo": "aa", "bars": [ "bb", "cc" ] } I am looking for a result like the following. The scalar value "aa" should be combined…
Christian
  • 65
  • 1
  • 8
0
votes
2 answers

ansible json filter list

I'm trying to filter out running services from the output of scan_services module (or service_facts in >= 2.5). The output of this module is something like this: "ansible_facts": { "services": { "NetworkManager-dispatcher.service":…
stevansv
  • 15
  • 1
  • 4
0
votes
1 answer

How do I filter the subelements of this JSON data with JMESPath

I am using Ansible to create users across multiple environments. I'm trying to consolidate my user var that contains all of the data needed to create new unix users into a globally shared var. To do this, I was planning on using subelements to…
Ryan Fisher
  • 1,485
  • 1
  • 19
  • 32
0
votes
1 answer

JMESPpath: filtering out by nested attributes

I am trying to apply the filter using JMESPath jp (https://github.com/jmespath/jp) utility. My goal is to have only the flow whose state is 'ADDED' and having specific device id (e.g. 0000debf17cff54b) filtered out. I am trying something like…
MAQ
  • 673
  • 6
  • 11
0
votes
1 answer

Filtering out Json with jmespath

I have this simple Python script, it is supposed to be part of something bigger I just cannot figure out how to work with jmespath #!/usr/bin/env python import jmespath if __name__ == '__main__': # input json text = \ { 'topology': [ …
HAXiAL
  • 1
  • 1
  • 3
0
votes
1 answer

JMESPath - how to prune a tree

I have a JSON data structure (actually, YAML) and want to reformat the stucture, but can't figure out how to get this to work correctly. This will be used within a jinja2 template in Ansible. The tool I have tried to use is the json_query filter,…
Kevin Keane
  • 1,506
  • 12
  • 24
0
votes
3 answers

Use JMESPath to search for two tags in AWS auto scaling groups

I have the following python boto3 code. It works fine to get me all the AutoScalingGroup names with a tag of "SubEnvironment" that has a value of "teal" What I really want is to add "StackName" with a value of "foo" to this so that I get exactly…
jb62
  • 2,224
  • 2
  • 14
  • 23
0
votes
1 answer

input validation via JMESpath in Angular 2

So for example i have the following input: in this input field is following input valid saleschannel.totalamount > 15. At the moment i test the validation with jmespath.search({ } ,…
sHamann
  • 789
  • 3
  • 10
  • 36
0
votes
2 answers

Ansible - Filter host groups by prefix

I'm trying to fetch the names of host groups in Ansible that have a specific prefix. Right now, I'm trying to delegate a template task to servers under host groups with the prefix "config_". I'm using json_query which uses JMESPath expressions. The…
0
votes
1 answer

ansible filter with json_query

I write this: - name: test for seed debug: var: hostvars|json_query("*.ansible_host") And it prints every host. But this does not filter hosts: - name: test for seed debug: var:…
vfsoraki
  • 2,186
  • 1
  • 20
  • 45
1 2 3
32
33