title: How to use jq to filter an array with elements of mixed type
body: <p>Given the below JSON, I'm trying to select all the <code>command</code> elements. My issue is that the <code>"checkout"</code> string is messing up my selection of all the <code>"run"</code> dicts. </p>
  
  <p>I'm trying to pass jq something like <code>.[].run.command</code> but I keep getting the error <code>jq: error (at &lt;stdin&gt;:33): Cannot index string with string "run"</code></p>
  
  <p>How do I exclude the <code>"checkout"</code> string from being selected?</p>
  
  <pre><code>[
    "checkout",
    {
      "run": {
        "command": "pip install cfn-lint pycodestyle pyflakes",
        "name": "Install Dependencies"
      }
    },
    {
      "run": {
        "command": "find stacks -type f -name \"*.yml\" -exec cfn-lint -i E3016 -i E3012 -i E1029 --template {} \\; | tee -a output.txt",
        "name": "Run cfn-lint"
      }
  },
    {
      "run": {
        "command": "find stacks -type f -name \"*.py\" -exec pyflakes {} \\; | tee -a output.txt",
        "name": "Run pyflakes"
      }
    },
    {
      "run": {
        "command": "pycodestyle --show-source --show-pep8 --ignore=E501,W605 stacks/src | tee -a output.txt",
        "name": "Run pycodestyle"
      }
    },
    {
      "run": {
        "command": "if [[ -s output.txt ]]; then cat output.txt; exit 1; fi",
        "name": "Exit if there are validation warnings/errors"
      }
    }
  ]
  </code></pre>