title: JMESPath nested OR statement
body: <p>I am using <a href="http://jmespath.org" rel="nofollow noreferrer">JMESPath</a> in Python to efficiently parse large dictionaries/lists.</p>
  <p>I have a list of dictionaries, for each dictionary I would like to obtain a certain value or return <code>null</code> and put the result into a list. i.e. im selecting a field from each dictionary but including a null value where the field dosn't exist.</p>
  <p>For example, my input is:</p>
  <pre><code>[
      {
          'foo': {'bar': 'yes1'}
      },
      {
          'foo': {'bar': 'yes2'}
      },
      {
          'foo1': {'bar': 'no'}
      }
  ]
  </code></pre>
  <p>The result I want is:</p>
  <pre><code>['yes1', 'yes2', None]
  </code></pre>
  <p>So for each dictionary in the list I want the path <code>foo.bar</code> or I want to return <code>None</code> if the path dosn't exist. The pseudo JMESPath expression I want is:</p>
  <pre><code>[*]( foo.bar||`null` )
  </code></pre>
  <p>i.e. select all list, then try the path foo.bar or return the literal null. <strong>However the brackets are syntactically incorrect. How do I encapsulate an OR expression in brackets?</strong> The best JMESPath expression I got is:</p>
  <pre><code>[*][foo.bar||``][]
  </code></pre>
  <p>The first two terms <code>[*][foo.bar||``]</code> places each element into a list nested into a list <code>[['yes1'], ['yes2'], ['']]</code>, then the <code>[]</code> flattens the returned list. However this is quite convulted and prevents me returning a null, so instead I return an empty string.</p>
  <p>Does any one have any ideas? Am I missing something syntactically?</p>