module.exports.in  = function(_msg) {
  if (_msg.properties.contentType === 'application/json') {
    try {
      return JSON.parse(_msg.content.toString());
    } catch(e) {}
  }

  return _msg.content.toString();
};

module.exports.out = function(content, options) {
  if (content !== undefined) {
    content = JSON.stringify(content);
    options.contentType = 'application/json';
  }

  return new Buffer(content);
};

module.exports.in  = function(_msg) {
  if (_msg.properties.contentType === 'application/json') {
    try {
      return JSON.parse(_msg.content.toString());
    } catch(e) {}
  }

  return _msg.content.toString();
};

module.exports.out = function(content, options) {
  if (content !== undefined && typeof content !== 'string') {
    content = JSON.stringify(content);
    options.contentType = 'application/json';
  }

  return new Buffer(content);
};

Fix bad formatting for string messages
Fix bad formatting for string messages
