title: How do I use JSON in the body of an http PUT in node.js?
body: <p>See my code below. I am trying to send { "status" : "accepted" } in the body of my request. The error I keep getting back from the API on their end is:</p>
  
  <p><code>{"message":"Unable to parse JSON in request body.","code":"invalid_json"}</code></p>
  
  <p>I can make this work in Swift but with that I'm using a dictionary object with the settings and serializing it. I don't know how to do that in Node.JS.</p>
  
  <pre><code>var https = require('https')
  
  var options = {
      "host": "sandbox-api.uber.com",
      "path": "/v1/sandbox/requests/" + req.body.request_id,
      "method": "PUT",
      "headers": { 
      "Authorization" : "Bearer " + req.body.bearer_token,
      "Content-Type" : "application/json",
      },
      "body" : {
          "status" : "accepted"
      }
  }
  
  callback = function(response) {
      var str = ''
      response.on('data', function(chunk){
          str += chunk
      })
  
      response.on('end', function(){
          console.log(str)
      })
  }
  
  https.request(options, callback).end()
  </code></pre>