title: Checking if JSON key is empty
body: <p>I'd like to be able to check if a JSON key is empty, then have the script exit depending on the result.</p>
  
  <p>I have the following JSON:</p>
  
  <pre><code>{
      "changed": false,
      "results": []
  }
  </code></pre>
  
  <p>If the "results" key is empty, as it is above, I want the script to exit with a return code of 0, otherwise it should return 1.</p>
  
  <p>I've tried</p>
  
  <pre><code>import json, sys
  
  obj=json.load(sys.stdin)
  
  if obj["results"]=="":
      exit(0)
  else:
      exit(1)
  </code></pre>
  
  <p>But this produces:</p>
  
  <pre><code>IndexError: list index out of range
  </code></pre>