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

How to export az network public-ip list output to a csv?

How do I go about exporting the output to a csv? Thanks in advance az network public-ip list --query "[].{name: name, address: ipAddress}" Here's the output: [ { address: "23.101.140.39", name: foo}, { address: "23.101.140.38", name: bar}, ] I…
gbackmania
  • 772
  • 3
  • 7
  • 17
0
votes
1 answer

Filter results using Jmespath on one dimensional array

Using jmespath and given the below json, how would I filter so only JobNames starting with "analytics" are returned? For more context, the json was returned by the aws cli command aws glue list-jobs { "JobNames": [ "analytics-job1", …
navig8tr
  • 1,724
  • 8
  • 31
  • 69
0
votes
1 answer

jmespath - how to search a json path with number as id?

I have a JSON like below and need to search the path 'root['quiz']['maths']['1']'. How is this possible? My original JSON below: { "dictionary_item_added":{ "root['quiz']['maths']['Corozno']":{ "question":"5 + 7 = ?", …
Anup
  • 39
  • 6
0
votes
1 answer

Concatenating a query expression in Azure CLI

I'm trying to query a list of soft-deleted Azure key vaults, then determine if the name of a specific key vault is listed. keyVaultName=whatever az keyvault list-deleted --query "[?contains(name, $keyVaultName)]" -o json That produces the…
awj
  • 7,482
  • 10
  • 66
  • 120
0
votes
1 answer

how to filter multiple keys value from json output using JMESPATH or json_query to use in ansible?

I want to filter every keys value from below json using json_query | JMESPATH, how to achieve this? { "facts_hash": { "processors::count": "96", "processors::physicalcount": "2", "processor0": "Intel(R) Xeon(R) Gold 6252 CPU @…
Bharat Gupta
  • 127
  • 1
  • 10
0
votes
1 answer

How to use JMESPath to query AWS CLI RDS instances by DBInstanceIdentifier

I need a list of RDS DBInstanceIdentifier that match the String "foobar" in their name. I found many solutions with exact match, but not substring matching. My approach looks as follows: I get a list of all DBInstanceIdentifier using: aws rds…
supernova
  • 1,762
  • 1
  • 14
  • 31
0
votes
1 answer

JMESPath issue with Cloud Custodian filter key for AMIs

I have a use case where I'd like to find AWS AMIs that have been shared with a particular account, using a periodically-run Lambda function, created by Cloud Custodian. To test this, I created two AMIs: one private/unshared, one shared with a known…
Conor
  • 1
0
votes
1 answer

awscli filter aws describe-auto-scaling-groups by multiple tag values

I have attempted and failed so far to achieve the below, Tags = 1 Values = Multiple (minimum 3) otherwise I could use OR as per example below, aws autoscaling describe-auto-scaling-groups --query…
0
votes
1 answer

What can be the issue for the following error: invalid character '-' after top-level value?

I am using the golang library go-jmespath to query a json file. My code looks like the following: package main import ( "encoding/json" "log" "github.com/jmespath/go-jmespath" ) func main() { var jsonBlob = []byte(`[ { …
thiloilg
  • 1,733
  • 2
  • 18
  • 23
0
votes
0 answers

jmespath select first matched attribute

I'd like to know if there is a succint way to express foo.bar||foo.boo with jmespath >>> import jmespath >>> jmespath.search("foo.bar||foo.boo", {"foo":{"bar":"a", "boo":"b"}}) 'a' >>> jmespath.search("foo.[bar||boo]", {"foo":{"bar":"a",…
jbernardes
  • 106
  • 5
0
votes
1 answer

Workaround need to extract a subset of the releases list from Azure DevOps using CLI

I run az pipelines release list --org $organization --project $project --top 1000 -o table to get all the releases in $project. I just get the first 100 releases - as there is a bug I reported…
0
votes
2 answers

How to get particular data from json url

I have following Json Data in php url File name : house.php { "Error": "", "ErrorCode": 0, "Guid": "", "Id": 0, "Success": true, "Value": [ { "MAIN": 225, "PHASE": 219418523, "G": "7TH Division", "GI": "2031892", "DOOR": "8907", "Gate": { "RG":…
MicroJson
  • 15
  • 6
0
votes
0 answers

JMESPath how to query by dynamic key?

How to get "beta" from following structure? { "key": "b", "data":{ "a": "alpha", "b": "beta" } }
MountLion
  • 1
  • 1
0
votes
1 answer

JMESPath - Unable to query a value in a list within another list

Given the following JSON: [ { "json": { "buildInfo": [ { "first": "James", "last": "d" }, { "first": "James2", "last": "d2" } ] }, …
Gareth
  • 89
  • 1
  • 3
0
votes
1 answer

What does a "JMES path query" look like when saving a variable in Tavern?

In my Tavern test file, I save a variable like so: [...] save: headers: csrf: x-csrf-token [...] When I run pytest, it logs this warning: tavern/util/dict_util.py:119: FutureWarning: In a future version of Tavern, selecting for values to save…
Mossmyr
  • 909
  • 2
  • 10
  • 26