title: How to handle JMESPath contains filter on attribute that may be null?
body: <p>I want to filter the output from the Azure CloudShell command <a href="https://docs.microsoft.com/fr-ca/cli/azure/ad/sp?view=azure-cli-latest#az-ad-sp-list" rel="noreferrer">az ad sp list</a> which outputs a JSON array, eg by filtering to Publisher Name = "ACME". All az commands support a --query argument which accepts a JMESPath expression.</p>
  
  <p>I have a JMESPath filter:</p>
  
  <pre><code>az ad sp list --query "[?contains(publisherName,'ACME')]" --all
  </code></pre>
  
  <p>that fails with error:</p>
  
  <pre><code>In function contains(), invalid type for value: None, expected one of: ['array', 'string'], received: "null"
  </code></pre>
  
  <p>I'm confident of my JMESPath syntax since a very similar expression works correctly:</p>
  
  <pre><code>az ad sp list --query "[?contains(displayName,'ACME')]" --all
  </code></pre>
  
  <p>I have a null filter that works fine:</p>
  
  <pre><code>az ad sp list --query "[?publisherName!='null']" --all
  </code></pre>
  
  <p>But when I combine the null filter with the contains filter I still get the error:</p>
  
  <pre><code>az ad sp list --query "[?publisherName!='null' &amp;&amp; contains(publisherName,'ACME')]" --all
  </code></pre>
  
  <p>I'm guessing that JMESPath filter doesn't support <a href="https://en.wikipedia.org/wiki/Short-circuit_evaluation" rel="noreferrer">boolean operations short circuit</a>. However I didn't find any statement about that on <a href="http://jmespath.org/" rel="noreferrer">http://jmespath.org/</a> or by googling.</p>
  
  <p>I don't know how to daisy chain or pipe with the Azure az command --query clause to apply the two filters separately.</p>
  
  <p>Any suggestion how to achieve my filtered output?</p>