title: How to serialize to JSON a list of model objects in django/python
body: <p>I am trying to serialize a list of model object defined as:</p>
  
  <pre><code>class AnalysisInput(models.Model):
      input_user = models.CharField(max_length=45)
      input_title = models.CharField(max_length=45)
      input_date = models.DateTimeField()
      input_link = models.CharField(max_length=100)
  </code></pre>
  
  <p>I wrote a custom serializer (encoder) for json.dumps():</p>
  
  <pre><code>class AnalysisInputEncoder(json.JSONEncoder):
      def default(self, obj):
          if isinstance(obj, AnalysisInput):
              return { "input_id" : obj.id,
                      "input_user" : obj.input_user,
                      "input_title" : obj.input_title,
                      "input_date" : obj.input_date.isoformat(),
                      "input_link" : obj.input_link }
          return json.JSONEncoder.default(self, obj)
  </code></pre>
  
  <p>When I serialize only one object, I am able to do it. When I try to serialize a list of object I get</p>
  
  <pre><code>[ objects..] is not JSON serializable
  </code></pre>
  
  <p>I searched but I didn't find where to work on.. I was thinking about writing a custom serializer also for list of model object.</p>