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
0 answers

Encoding a JMESPath in a query URL

I am calling an API to evaluate a JMESPath expression passed as a query parameter. All goes well until I try to use logical AND. How do I encode the ampersand in the URL? Using logical OR the URL looks…
Spaceghost
  • 6,835
  • 3
  • 28
  • 42
0
votes
1 answer

select part of AWS CLI query output

I want to return only the current AWS username using AWS CLI. I'm on Windows 11. I think there's a way to do it using a regex but I can't figure out how. I think I need to use a pipe along with a regex but there's no related examples on the JMESPath…
mdailey77
  • 1,673
  • 4
  • 26
  • 52
0
votes
2 answers

Parse a value from the json

I have a following json { "kind":"testObject", "spec":{ }, "status":{ "code":"503" } } I would like to just retrieve the value of code, so that it would just show 503 as an output. I did try with JMESPath, but that binary is out of…
0
votes
0 answers

jmespath date conversion while querying aws

I made these two: aws_ecs_list_services(){ cluster=${1:-xxxx} taskarn=$(aws ecs list-services --cluster $cluster | grep "arn" | tr -d '"'| cut -d':' -f6 | cut -d'/' -f3 | tr -d ',') echo $taskarn; …
bruvio
  • 853
  • 1
  • 9
  • 30
0
votes
0 answers

JMESPath - How can I convert a json object to Json Array?

I'm importing a JSON into a table sheet. But when I import with JMESPath, the system creates columns for each {date_time}. I tried to create a filter with JMESPath, but I still can't! Is there anyone here who can help me? I think of two options:…
0
votes
1 answer

AWS CLI search through tags

I want to filter multiple tags on AWS CLI. I have something like this: aws ec2 describe-instances --filters Name=instance-state-name,Values=running --query 'Reservations[*].Instances[*].Tags[*]' this command gives me all my tags on instances. I have…
0
votes
1 answer

How can I get all data from JSON using JMESPath

I am trying to get all the data with the attribute _name equal to accountId. I have managed to do it almost fine, the only issue is that from times to times times I have an object. with two _name attributes with the value accountId and for this…
Bruno Lorena
  • 73
  • 1
  • 9
0
votes
1 answer

Azure JMESPATH query for nested json

I'm trying to extract just the paths portion of the result of this AZ CLI query: az network application-gateway show --query urlPathMaps --resource-group dev-aag --name dev-aag-gateway I'm unsure if I should use az network application-gateway list…
0
votes
1 answer

create-export-task | Filter CloudWatch logs using JMESpath

I want to use create-export-task to store some logs into S3. Given my CloudWatch logs appear in the following format: { "message": "Example message", "errorCode": "MY_ERROR_CODE_1", "someFlag": "flag", "otherFlag": "flag2", "level": "error" } {…
evonzz
  • 139
  • 6
0
votes
1 answer

JMESPath to return as json

JMESPath can be used to query json but the return is no longer json any more: E.g., searching {"a": "foo", "b": "bar", "c": "baz"} with JMESPath a will yield "foo". How can I return {"a": "foo"} instead? jq is able to do it: curl…
xpt
  • 20,363
  • 37
  • 127
  • 216
0
votes
0 answers

Extracting JSON Data from list that does not have a key

I am attempting to extract data from a JSON output utilizing JMESPath that does not contain a key for the list and I am currently unable to extract this data properly. I have attempted to use "[]." as the extractor for this information but the…
0
votes
0 answers

JMESPATH query expression for matching Value in an Array

I have the following JSON { “Record”: [ { “FirstName": “John”, “LastName”: “Smith”, “City”: “Chicago”, “Possessions”: [ { “Item”: “TV” }, { “Item”: “XBOX-S” }, { “Item”:…
0
votes
1 answer

JMESPath query for aws cli EMR

How do I perform a "regex" type match on a start of a string in jmespath? aws emr list-clusters --active --query 'Clusters[?Name==`My-Cluster`].Id' --output text I was looking at the answers in AWS CLI EMR get Master node Instance ID and tag it and…
RunThor
  • 169
  • 2
  • 10
0
votes
0 answers

How can I get element value in JSON file could be nested with Jmespath?

I have a JSON file that shows the hierarchy filesystem. For parsing JSON files I choose Jmespath to pars and get data. below JSON file could be nested. I want to select File name based on hierarchy. { …
Alex
  • 31
  • 4
0
votes
2 answers

azure cli query return invalid type for value received null

Trying to query az repos policy list with query of: [?type.displayName=='Build' && contains(settings.displayName, 'Test')] returning message: Invalid jmespath query supplied for `--query`: In function contains(), invalid type for value: None,…
confused-nerd
  • 47
  • 1
  • 6