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 can I get every URL from dictionary in Python?

I have a yaml string representing a menu. After I have a dictionary from it, I try to get URL simply said the key url of Parameter and every first element of list for other element that is not Parameter. Here what I tried import yaml import…
Houy Narun
  • 1,557
  • 5
  • 37
  • 86
0
votes
1 answer

How to fetch appid and password in AZ Cli PowerShell using jmespath?

Hello I am trying to create a service account using the below az cli commands. I am trying to fetch the appId and password into a powershell object using Jmespath. This is what I am trying to do. $serviceprincipalname ="k8ssp" $spdetails = $( az ad…
Pradeepl
  • 198
  • 1
  • 12
0
votes
1 answer

how to specify nested json path in jmespath and jmeter

My jmeter test receives the following json response {"result":"success","additional-info":"{"external-profile":{"email":"myemail@gmail.com","firstname":"fn","lastname":"ln","portfolio":{"tags-of-interest":[],"question-created-tags":[{"tag":"un2-new…
Manu Chadha
  • 15,555
  • 19
  • 91
  • 184
0
votes
2 answers

jmes path assertion failing in jmeter

In my jmeter test, the test receives the following json…
Manu Chadha
  • 15,555
  • 19
  • 91
  • 184
0
votes
2 answers

Azure CLI query help - JMESPath - filter using key having space , extract keys with space in them ( from Powershell )

Good morning everyone, Happy Friday! Edit: Ended up solving it myself while debugging through it.. Thought I will post it here regardless so that anyone who comes here may get the solution... Was helped by microsoft…
miniGweek
  • 380
  • 4
  • 15
0
votes
1 answer

Chaining filters in JMESpath

I want to be able to chain together multiple filters using JMESpath but it appears you cannot filter on the output of a filter. My working example is as follows: // document: { pips: { ancestors:[{ id: 'p01234567' }], episode: { …
lintal
  • 339
  • 3
  • 15
0
votes
1 answer

azure jmespath query list with json

I have something like this from Azure nsg query [ { "access": "Deny", ... ... "sourceAddressPrefixes": [ "x.x.x.x", "y.y.y.y" ], "sourceApplicationSecurityGroups": null, …
user3739312
  • 87
  • 1
  • 1
  • 8
0
votes
1 answer

How can I remove None value from python dictionary?

I have the python dictionary like this data_dict = {'col_1': [{'size': 3}, {'classes': 'my-3 text-light text-center bg-primary'}, {'styles': [{'font-size': '14px'}]}]} Using jmespath library, I tried to achieve the desired result of dictionary like…
Houy Narun
  • 1,557
  • 5
  • 37
  • 86
0
votes
1 answer

JMESPath nested AND query (one-liner)

I'm working on an custom Azure Devops and trying to fill my fields through a json file. I manage to get the data one layer deep, but 2 layers seems to be challenging. My source: { "Projects": [ { "Name": "Phoenix", "CatalogItems":…
0
votes
1 answer

jmespath: how to search a dict of dict structure

There's an example of search in the tutorial going: { "machines": [ {"name": "a", "state": "running"}, {"name": "b", "state": "stopped"}, {"name": "b", "state": "running"} ] } In [68]:…
Joce
  • 2,220
  • 15
  • 26
0
votes
2 answers

How can I repeat a value alongside nested values in a JMESPath query?

Problem I'd like to unpack an object into an array of objects, repeating a top-level key alongside values from a nested array. This seems trivial enough, but none of the tutorials or examples at jmespath.org cover this case. Input data { "name":…
ryantuck
  • 6,146
  • 10
  • 57
  • 71
0
votes
1 answer

JMESPath cast string to number then filiter by greater than 0 get "Invalid token (Number): "0"" error message

I want to get pretaxCost > 0 data but i met trouble like below : my JMESPath [?pretaxCost.to_number(@) > 0] demo data : [ { "pretaxCost": "7.19999999999999962124684594298729134465020251809619367122650146484375E-8", "instanceName":…
Wei Lin
  • 3,591
  • 2
  • 20
  • 52
0
votes
1 answer

How JMESPath summary data

az consumption usage list -m --query "sort_by([],&usageQuantity)[-5:].{name:instanceName,ser:consumedService,cat:meterDetails.meterCategory,qty:usageQuantity}" get json : [ { "cat": "Azure App Service", "name": "weiwebapp02serviceplan", …
Wei Lin
  • 3,591
  • 2
  • 20
  • 52
0
votes
1 answer

Can't get AWS CLI Command to run in Jenkins script

I am running a AWS command and attempting to capture the command weight = sh ( script: """ aws route53 list-resource-record-sets \ --hosted-zone-id ${HOSTED_ZONE_ID} \ --query "ResourceRecordSets[?Type…
Alan
  • 9,331
  • 14
  • 52
  • 97
0
votes
2 answers

How to filtered using value in array with nested json with JMESPath?

I have this: { Item: [ { key1: 'one', key2: 'two', key3: ["Sam", "Jack"] }, { key1: 'one', key2: 'two', key3: ["Annie", "Jason"] } ] } So I wanted to get the…
Sam Min Wong
  • 151
  • 3
  • 18