title: When is this JSON structure getting converted to all strings?
body: <p>I am sending a JSON structure to my node/express server and saving the object into a database. The problem is that I send JSON with integers and booleans but everything gets saved as strings.</p>
  
  <p>Here is my node/express code:</p>
  
  <pre><code>var express = require('express');
  
  var app = express();
  app.enable("jsonp callback");
  app.use(express.bodyParser());
  
  // allow cross origin scripting to get data from devices directly
  app.all('*', function(req, res, next) {
    res.header('Access-Control-Allow-Origin', '*');
    res.header('Access-Control-Allow-Methods', 'PUT, GET, POST, DELETE, OPTIONS');
    res.header('Access-Control-Allow-Headers', 'Content-Type');
    next();
  });
  
  app.post('/departures', function(req, res) {
  
  /* I started using this to convert back to integers - but need to solve the problem
      for (var i in req.body.data) {
        req.body.data[i].siteid = parseInt(req.body.data[i].siteid);
      }
  */
      console.log('saving data '+JSON.stringify(req.body.data));
      positionProvider.save(req.body.data, function(){
        res.json({status:'success'});
      })
  });
  </code></pre>
  
  <p>Here is how I am POSTing with jquery:</p>
  
  <pre><code>    var data = [{"siteid":123}];
  
      $.ajax({
          type: 'POST',
          url: serverUrl + '/departures',
          data: {
              data: data
          },
          success: function(resp) {
              alert('saved departure data '+JSON.stringify(data))
          },
          error: function(err) {
              console.log('error posting to server...');
              console.log(err);
          }
      });
  </code></pre>
  
  <p>The jquery side reports that it sent {"siteid":123} but the node side reports that it received {"siteid":"123"}.</p>
  
  <p>Where is the integer getting converted to a string?</p>