Search code examples
jmespath

How do I use JMESPath to query values in a list?


Given the following structure,

{
    "Imports": [
        "network-secgrp", 
        "bastion", 
        "network-nacl"
    ]
}

How do I get JMESPath to only output the values that start with network?


Solution

  • With

    Imports[?starts_with(@, `network`)]
    

    You will have

    [
      "network-secgrp",
      "network-nacl"
    ]
    

    I recommend you to use this editor http://jmespath.org/

    It is a great playground :)