title: How to serialize an array posted to a django backend
body: <p>I'm trying to serialize an array that comes from a form. The array looks like this:</p>
  
  <pre><code>some_id: 12
  array1[]:1
  array1[]:2
  array2[]:5
  array2[]:6
  </code></pre>
  
  <p>or, as it arrives in <code>request.POST</code> </p>
  
  <pre><code>&lt;QueryDict: {
      'array1[]': ['1', '2'], 
      'array2[]': ['5', '6'], ...
  </code></pre>
  
  <p>Now I get the serializer working for the simple id: <code>some_id = serializers.IntegerField()</code>, which is great. I've tested it without the arrays and everything works as expected.</p>
  
  <p>For the array I thought I found this serializer field: <a href="http://www.django-rest-framework.org/api-guide/fields/#listfield" rel="nofollow noreferrer">listfield</a><br>
   I tried the following implementation:</p>
  
  <pre><code>array1 = serializers.ListField(
      child=serializers.IntegerField(min_value=1)
  )
  </code></pre>
  
  <p>This looks like the manual says how it works, but it only seems to give me the following error:</p>
  
  <blockquote>
    <p>TypeError at /api/myendpoint/
    'int' object is not iterable</p>
  </blockquote>
  
  <p>I'm not really sure where I went wrong, maybe I'm on the wrong track (really not a Django guy :) ), but I'm sure it's a small mistake.</p>
  
  <p><strong>So how can I serialize a posted array (or should I call it a Dict?)</strong></p>
  
  <p>The complete trace doesn't seem to be containing anything strange, but i've kept it available <a href="http://pastebin.com/GUKZJHMu" rel="nofollow noreferrer">on pastebin</a></p>
  
  <p>The data is posted with this jquery code:</p>
  
  <pre><code>var mydata = {
      array1: [1,2],
      array2: [5,6],
      some_id: 12
  };
  
  $.ajax({
      url: "http://domain.com//api/myendpoint/",
      dataType: "json",
      data: mydata,
      method: "POST"
  })
  </code></pre>
  
  <p>I'm using:</p>
  
  <ul>
  <li>Django 1.10.2</li>
  <li>djangorestframework 3.5.2</li>
  <li>jquery 2.1.4</li>
  </ul>