0

I have a situation where the objects I am querying have unknown property names, and I would like to query the property names using JMESPath.

Here is an Azure CLI command and example output for it...Is there a way to get the names of the triggers without getting the value?

az logic workflow list --query "[].{name:name, triggers:definition.triggers}"
[
  {
    "name": "MyFirstLogicApp",
    "triggers": {
      "When_I_upload_a_new_video": {
        ...bunch of json...
      }
    }
  },
  {
    "name": "MySecondLogicApp",
    "triggers": {
      "When_an_S3_object_is_updated": {
        ...bunch of json...
      }
    }
  },
  {
    "name": "MyThirdLogicApp",
    "triggers": {
      "When_a_file_is_created_(properties_only)_(V2)": {
        ...bunch of json...
      }
    }
  },
  {
    "name": "MyFourthLogicApp",
    "triggers": {
      "When_a_file_is_modified_(properties_only)_(V2)": {
        ...bunch of json...
      }
    }
  }
]
Josh Withee
  • 9,922
  • 3
  • 44
  • 62
  • Sorry but is there any other way you can ask your question or at least clarify the requirement? Personally, I’m a little confused. – Skin May 25 '23 at 21:06

1 Answers1

1

Use the keys function to get only the keys of the provided object:

az logic workflow list --query "[].{name:name, triggers:keys(definition.triggers)}"
Josh Withee
  • 9,922
  • 3
  • 44
  • 62
Victor Silva
  • 723
  • 4
  • 17