title: Creating a jSON Array using Django
body: <p>I am trying to create a jSON object with sample output such as</p>
  
  <pre><code>{
      "pickups": [
          {
              "id": " ",
              "name": " ",
              "number": " ",
              "time": " ",
              "status": " "
          },
          {
              "id": " ",
              "name": " ",
              "time": " ",
              "number": " ",
              "status": " "
          }
      ]
  }
  </code></pre>
  
  <p>I am getting a sample response like</p>
  
  <pre><code>  {'status': '1', 'time': datetime.date(2013, 2, 27), 'number': 4L, 'name': u'Dr  John', 'id': 83L}{'status': '1', 'time': datetime.date(2013, 2, 27), 'number': 4L, 'name': u'Ricky', 'id': 84L}
  </code></pre>
  
  <p>What I have been tried</p>
  
  <pre><code>        pickup_records = []
          for tmpPickUp in pickup:
              pickup_date=tmpPickUp.pickup_date
              pickup_time=tmpPickUp.pickup_time
  
              pickup_id = tmpPickUp.id
              pickup_name=tmpPickUp.customer_name
              pickup_number=tmpPickUp.pieces
              print pickup_date,pickup_time,pickup_id,pickup_name,pickup_number
              record = {"name":pickup_name, "id":pickup_id,"time":pickup_date,"number":pickup_number,"status":"1"}
              print record
              pickup_records.append(record)
  
          #pickup_records = json.dumps(pickup_records) 
          pickup_records = json.dumps(pickup_records, indent=4) 
          pickup_response={"pickup":pickup_records}
          return HttpResponse(pickup_response, content_type="application/json") 
  </code></pre>
  
  <p><strong>EDIT 1</strong></p>
  
  <pre><code>            for tmpPickUp in pickup:
                  pickup_date=tmpPickUp.pickup_date
                  pickup_time=tmpPickUp.pickup_time
  
                  pickup_id = tmpPickUp.id
                  pickup_name=tmpPickUp.customer_name
                  pickup_number=tmpPickUp.pieces
                  print pickup_date,pickup_time,pickup_id,pickup_name,pickup_number
                  record = {"name":pickup_name, "id":pickup_id,"time":pickup_date,"number":pickup_number,"status":"1"}
                  print record
                  pickup_records.append(record)
  
              pickup_response={"records":pickup_records}
              print "before pickup+records",pickup_response 
              #pickup_records = json.dumps( pickup_response, sort_keys=True, indent=4)
              print "after pickup+records"  
              #pickup_response={"pickup":pickup_records}
              print "after pickup+response"
              return HttpResponse(pickup_response, content_type="application/json")
  </code></pre>
  
  <p><strong>LOG RESPONSE</strong></p>
  
  <pre><code>before pickup+records {'records': [{'status': '1', 'time': datetime.date(2013, 2, 27), 'number': 4L, 'name': u'Dr Ayurveda Delhi', 'id': 83L}, {'status': '1', 'time': datetime.date(2013, 2, 27), 'number': 4L, 'name': u'Callmate India', 'id': 84L}]}
  </code></pre>
  
  <p>I suppose I am making mistakes on <code>return HttpResponse(pickup_response, content_type="application/json")</code> Please correct me</p>