docs/assets/js/io.js
function(url, jsonObject, callback, options) {
    var options = JSON.parse(JSON.stringify(options || {}));
    options.headers = options.headers || {};
    options.headers["Content-type"] = "application/json";
    return request(
      url,
      JSON.stringify(jsonObject),
      function(err, content) {
        if (err) {
          return callback(err);
        }
        try {
          var json = JSON.parse(content);
        } catch (e) {
          return callback(e);
        }
        callback(null, json);
      },
      options);
  }
function(url, jsonObject, callback, options) {
    var options = JSON.parse(JSON.stringify(options || {}));
    options.headers = options.headers || {};
    options.headers["Content-type"] = "application/json";
    return request(
      url,
      JSON.stringify(jsonObject),
      function(err, content) {
        if (err) {
          return callback(err);
        }
        try {
          var json = JSON.parse(content);
        } catch (e) {
          return callback(e);
        }
        callback(null, json);
      },
      options);
  }
function ( url , jsonObject , callback , options ) { var options = JSON . parse ( JSON . stringify ( options || { } ) ) ; options . headers = options . headers || { } ; options . headers [ "Content-type" ] = "application/json" ; return request ( url , JSON . stringify ( jsonObject ) , function ( err , content ) { if ( err ) { return callback ( err ) ; } try { var json = JSON . parse ( content ) ; } catch ( e ) { return callback ( e ) ; } callback ( null , json ) ; } , options ) ; }
sends a JSON 'POST' request, returns JSON repsonse
@memberOf module:IO
@param {string} url url to POST to.
@param {Object=} jsonObject JavaScript object on which to
call JSON.stringify.
@param {!function(error, object)} callback Function to call
on success or failure. If successful error will be
null, object will be json result from request.
@param {module:IO~Request~Options?} options
sends a JSON POST request returns JSON repsonse