title: List index out of range (using json)
body: <p>I have imported json and filtred it by name.</p>
  
  <pre><code>def lootprice(json_object, name):
      needobj = [obj for obj in json_object if obj['name'] == name][0]
      if needobj['have'] &lt; needobj['max']:
          return needobj['price']
  </code></pre>
  
  <p>It works some time and than shows this kind of error:</p>
  
  <blockquote>
  <pre><code>needobj = [obj for obj in json_object if obj['name'] == name][0] 
  </code></pre>
    
    <p>IndexError: list index out of range</p>
  </blockquote>