azure-devops-cli-extension icon indicating copy to clipboard operation
azure-devops-cli-extension copied to clipboard

JMESPath Cannot query values containing a dot in the key

Open Apollo-Roboto opened this issue 2 years ago • 3 comments

This is autogenerated. Please review and update as needed.

Describe the bug

Trying to query specific values from a work-item using the az boards cli with the --query parameter fails as some of the keys in the JSON payload contains a dot in them. The following parameter is expected to return the title of a work item: --query "fields.`"System.Title`""

Sample payload without the --query

{
  "fields": {
    ...
    "System.Description": "<div>Sample Description</div>",
    "System.Id": 1234,
    "System.Title": "Sample Title"
    ...
  },
  ...
}

Command Name az boards work-item show Extension Name: azure-devops. Version: 0.21.0.

To Reproduce:

Command used (id and organization has been removed)

az boards work-item show `
  --id {} `
  --organization {} `
  --query "fields.`"System.Title`""

Expected Behavior

The title of the task returned in the terminal output.

Environment Summary

Windows-10-10.0.18362-SP0
Python 3.8.9
Installer: MSI

azure-cli 2.26.1 *

Extensions:
azure-devops 0.21.0

Additional Context

Apollo-Roboto avatar Feb 25 '22 21:02 Apollo-Roboto

Seconded, this is blocking me from checking if an ACR Task credentials exists as I can't query the result object.

joshuadmatthews avatar Jun 30 '22 16:06 joshuadmatthews

Try: 'fields."System.Title"'

oyvindh avatar Jan 31 '23 11:01 oyvindh

Escaping the quotes as suggested in here works for me --query 'fields.\"System.Title\"'

lambda-snail avatar Feb 14 '23 07:02 lambda-snail