code: function encode(data) {
    var encodedData = null;
    try {
      encodedData = JSON.stringify(data);
    } catch (err) {
      logger.warn('failed encoding data', data);
    }
    return encodedData;
  }
docs: /* encoding & decoding