title: Formatting, integers, and dicts in POST request
body: <p>The script on the server sends back <code>data.location</code> and redirects the browser to <code>data.location</code>, which I want to capture in my script. This code returns <code>{"location": null}</code>:</p>
  
  <pre><code>def load_page(self, response):
      """
      Get server response for the data sent.
  
      FormRequest from Chrome console:
  
      location:https://www.example.com/menu/
      top_level:false                                   &lt;--- boolean
      section:4                                         &lt;--- integer
      departmets:[{"desc":"dep-select", "value":"119"}] &lt;--- string (?)
  
      """
      url = urlparse.urljoin(self.var.root[:-1], 'navigation/load_department/')
      formdata={'location':'https://www.example.com/menu/',
                'section': '4', 
                'departments':'[{"desc":"dep-select", "value":"119"}]',
                'top_level': 'False'}
  
      return scrapy.FormRequest(url=url,
                     method='POST', 
                     formdata=formdata, 
                     callback=self.next_page)
  </code></pre>
  
  <p>What I expect is <code>{"location": 'some URL'}</code>.</p>
  
  <ul>
  <li>I suspect it's because the 4 above is integer which I managed to send only as a string.</li>
  <li>If I send it as an integer, scrapy complains that it expects only str or unicode.</li>
  <li>If I send the request as <code>formdata=json.dumps(...)</code>, there is another error about unpacking the values.</li>
  <li>Scrapy does not accept dict in <code>departments=</code>.</li>
  <li>Request with <code>Request(body=json(...))</code> returns only <code>{}</code>.</li>
  </ul>
  
  <p>How can I pass this integer to <code>formdata</code>, and/or is this a properly formatted POST request?</p>
  
  <p>Thank you! </p>