title: Django: "TypeError: [] is not JSON serializable" Why?
body: <p>How can this be that this error was raised? I entered this:</p>
  
  <pre><code>def json(self):
      return json.dumps(
          {
              'items': self.items
          }
      )
  </code></pre>
  
  <p>and got that error (because self.items was an empty queryset (Django)</p>
  
  <p>but then,</p>
  
  <pre><code>def json(self):
      return json.dumps(
          {
              'items': []  # Pass in empty list to prove that the error was idiotic.
          }
      )
  </code></pre>
  
  <p>worked fine (which at least proves that the error message is worthless)</p>
  
  <p>Is this because the queryset defines <strong>repr</strong>() and returns '[]' as a string when it's empty or something  ridiculous like that?</p>