code: function(object) {
              // three special objects that we want to treat differently
              if(object == null) {
                  return "null";
              }
              if(object.constructor == Date) {
                  return this.serialize.date.apply(this, [object]);
              }
              if(object.constructor == Array) {
                  return this.serialize.array.apply(this, [object]);
              }
              var pieces = ['{'];
              this.level += 1;
              var key, keyJSON, valueJSON;
              
              var addComma = false;
              for(key in object) {
                  if(object.hasOwnProperty(key)) {
                      // recursive calls need to allow for sub-classing
                      keyJSON = OpenLayers.Format.JSON.prototype.write.apply(this,
                                                      [key, this.pretty]);
                      valueJSON = OpenLayers.Format.JSON.prototype.write.apply(this,
                                                      [object[key], this.pretty]);
                      if(keyJSON != null && valueJSON != null) {
                          if(addComma) {
                              pieces.push(',');
                          }
                          pieces.push(this.writeNewline(), this.writeIndent(),
                                      keyJSON, ':', this.writeSpace(), valueJSON);
                          addComma = true;
                      }
                  }
              }
              
              this.level -= 1;
              pieces.push(this.writeNewline(), this.writeIndent(), '}');
              return pieces.join('');
          }
docs: Method: serialize.object
  Transform an object into a JSON string.
  
  Parameters:
  object - {Object} The object to be serialized.
  
  Returns:
  {String} A JSON string representing the object.