title: POST a Python list to a Node.js server expecting payload consisting of an array containing JSON
body: <p>I am trying to send a POST request (in Python) to a server that is expecting an array containing JSON.  I can't seem to format the data properly.  How can I format the following payload to behave like a JavaScript array for a Node.js server?</p>
  
  <p><strong>POST</strong> /api/adduser/</p>
  
  <p>Node.js expected Payload:</p>
  
  <pre><code>[ 
      {'user':'jon','email':'email@gmail.com'}, 
      {'user':'jon2','email':'email2@gmail.com'} 
  ]
  </code></pre>
  
  <p>My current code:</p>
  
  <pre><code>import requests
  import json
  
  payload = \
  [
     {
         'user': 'hello',
         'email': 'hello@gmail.com'
     },
     {
         'user': 'helloAgain',
         'email': 'helloAgain@gmail.com'
     }
  ]
  
  res = requests.post('http://localhost/api/users', data=json.dumps(payload))
  
  #res -&gt; 400 error -&gt; reason:  "wrong json format - must be an array"
  </code></pre>