code: function(value, pretty) {
          this.pretty = !!pretty;
          var json = null;
          var type = typeof value;
          if(this.serialize[type]) {
              try {
                  json = (!this.pretty && this.nativeJSON) ?
                      JSON.stringify(value) :
                      this.serialize[type].apply(this, [value]);
              } catch(err) {
                  OpenLayers.Console.error("Trouble serializing: " + err);
              }
          }
          return json;
      }
docs: APIMethod: write
  Serialize an object into a JSON string.
  
  Parameters:
  value - {String} The object, array, string, number, boolean or date
  to be serialized.
  pretty - {Boolean} Structure the output with newlines and indentation.
  Default is false.
  
  Returns:
  {String} The JSON string representation of the input value.