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 . JMESPath allows you to extract elements from a JSON document. It also allows you to directly transform the queried elements. So to speak, JMESPath is for JSON what is for . For questions on JSON itself please use the tag.

Useful Links:

295 questions
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
  • 497
  • 4
  • 17
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…
Vijay Vat
  • 317
  • 1
  • 3
  • 9
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
  • 8,910
  • 11
  • 56
  • 125
0
votes
1 answer

Filtering addresses matching condition

I want to provide list of allowed VLAN's as a variable to my server. Ansible playbook should be able to filter server's IP addreses based on this VLAN's. I have a list of all IP addresses available on server (ansible_all_ipv4_addresses from ansible…
Halis
  • 309
  • 1
  • 8
0
votes
1 answer

New to JMESPath -> filter array without key/value pairs

I am trying to filter a list of objects with jmes, so far, I am able to filter a quite big datasructure, so I get a list of a structure like this: [{ id: "foo" name: "bar" targets: ["something", "somethingelse", "blabla"] }, ...] what…
Martin
  • 2,894
  • 22
  • 37
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,029
  • 1
  • 17
  • 34
0
votes
1 answer

Select mid-level attribute from JMESPATH expression

I am trying to select the cluster name for a specific virtual machine using Ansible's json_query which uses JMESPATH in the backend. I have followed the tutorial and examples at http://jmespath.org but am unable to construct the correct query. My…
bruabetic
  • 11
  • 3
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
  • 41
  • 5
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
  • 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,116
  • 13
  • 26
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
  • 653
  • 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
  • 3
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
  • 1,400
  • 1
  • 10
  • 19
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
  • 567
  • 2
  • 6
  • 29
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…
1 2 3
19
20