In JMESPath is there a way to return a list of dynamic keys based on condition of child key value pair

Viewed 331

Based on the JSON the below I would like to return a list of the enabled account numbers using something like [?enabled == 'true'] with output like [11111, 33333]. Since the account numbers aren't stored in a key value pair is this possible?

{
    "account": {
        "11111": {
            "account-name": "account-1",
            "enabled": "true"
        },
        "22222": {
            "account-name": "account-2",
            "enabled": "false"
            
        },
        "3333": {
            "account-name": "account-3",
            "enabled": "true"
            
        }
    }
}
0 Answers
Related