spec/lib/jspec.js
function(object) {
        var self = this
        if (object == undefined || object == null) return 'null'
        if (object === true) return 'true'
        if (object === false) return 'false'
        switch (typeof object) {
          case 'number': return object
          case 'string': return this.escapable.test(object) ?
            '"' + object.replace(this.escapable, function (a) {
              return typeof self.meta[a] === 'string' ? self.meta[a] :
                '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4)
            }) + '"' :
            '"' + object + '"'
          case 'object':  
            if (object.constructor == Array)
              return '[' + map(object, function(val){
                return self.encode(val)
              }).join(', ') + ']'
            else if (object)
              return '{' + map(object, function(key, val){
                return self.encode(key) + ':' + self.encode(val)
              }).join(', ') + '}'
        }
        return 'null'
      }
function(object) {
        var self = this
        if (object == undefined || object == null) return 'null'
        if (object === true) return 'true'
        if (object === false) return 'false'
        switch (typeof object) {
          case 'number': return object
          case 'string': return this.escapable.test(object) ?
            '"' + object.replace(this.escapable, function (a) {
              return typeof self.meta[a] === 'string' ? self.meta[a] :
                '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4)
            }) + '"' :
            '"' + object + '"'
          case 'object':  
            if (object.constructor == Array)
              return '[' + map(object, function(val){
                return self.encode(val)
              }).join(', ') + ']'
            else if (object)
              return '{' + map(object, function(key, val){
                return self.encode(key) + ':' + self.encode(val)
              }).join(', ') + '}'
        }
        return 'null'
      }
function ( object ) { var self = this if ( object == undefined || object == null ) return 'null' if ( object === true ) return 'true' if ( object === false ) return 'false' switch ( typeof object ) { case 'number' : return object case 'string' : return this . escapable . test ( object ) ? '"' + object . replace ( this . escapable , function ( a ) { return typeof self . meta [ a ] === 'string' ? self . meta [ a ] : '\\u' + ( '0000' + a . charCodeAt ( 0 ) . toString ( 16 ) ) . slice ( - 4 ) } ) + '"' : '"' + object + '"' case 'object' : if ( object . constructor == Array ) return '[' + map ( object , function ( val ) { return self . encode ( val ) } ) . join ( ', ' ) + ']' else if ( object ) return '{' + map ( object , function ( key , val ) { return self . encode ( key ) + ':' + self . encode ( val ) } ) . join ( ', ' ) + '}' } return 'null' }
JSON encode _object_.

@param  {mixed} object
@return {string}
@api private
JSON encode _object_ .