title: Nested Dictionaries to JSON for the POST request Python
body: <p>I am having trouble converting the payload data in the form of nested dictionaries to pass it as a data for the POST request using Python requests module. The form data is as below:</p>
  
  <pre><code>payload = {'request':  {
                  'appkey': "936725A4-7D9A-11E5-81AC-86EC8D89CD5A"},
              'formdata':{
                      'currency':'US',
                      'dataview':'store_default',
                      'distinct':'_distance, clientkey',
                      'geolocs':{
                              'geoloc':[{
                                      '0':{
                                              'address1':'',
                                              'addressline':'19128, PA',
                                              'city':'Philadelphia',
                                              'country':'US',
                                              'latitude':'40.0532987',
                                              'longitude':'-75.23040379999998',
                                              'postalcode':'19128',
                                              'province':'',
                                              'state':'PA'}}]
                              },
                      'google_autocomplete':'true',
                      'limit':'250',
                      'nobf':'1',
                      'searchradius':'15|25|50|100|250|350|450|550|650|750|850|950',
                      'true':'1',
                      'where':{'partner_reseller': {'eq':'1'}}}                    
            }
  
  r = requests.post(url,data=simplejson.dumps(payload),headers=header)
  result = simplejson.loads(str(r.content))
  </code></pre>
  
  <p>Can somebody please assist me with structure and can point out the mistake in what I have written. I keep getting the following error:</p>
  
  <pre><code>{'code': 1008,
   'response': {'message': 'The submitted XML is not properly formed'}} 
  </code></pre>
  
  <p>I'll appreciate your help a lot. Thank you.</p>