window.JSON={
    parse:function(str){
        return eval('('+str+')');
    },
    stringify:function(str){
      
        if(typeof str=='number'){
            return  String(str)
        }
        if(typeof str=='string'){
            return str;
        }
        var s=''
        switch(Object.prototype.toString.call(str)){
            case '[object Array]' :
                s+="[";
                for(var i=0;i<str.length-1;i++){
                   
                    if(typeof str[i]=='string'){s+='"'+str[i]+'",'}else{
                    s+=str[i]+','}
                }
                if(typeof str[str.length-1]=='string'){s+='"'+str[i]+'"'}else{
                   if(str[str.length-1]==null){str[str.length-1]=null;
                   s+='null';
                   }else{
                    s+=(str[str.length-1]?str[str.length-1]:'')
                   }
                    }
                    s+="]"
            break;
            case '[object Date]':
           
                s+= '"' + (str.toJSON ? str.toJSON() : str.toString()) + '"';
                    break;

            case '[object Object]':
            s+='{'
                for(var key in str){
                   

                    if(str[key]===undefined){
                        continue;
                    }
                   if(str[key]===null){
                       s+='"'+key+'":'+str[key]+","
                       continue;
                   }
                   if(typeof str[key]=='symbol'||typeof str[key]=='function'){
                       continue;
                   }
                   if(Object.prototype.toString.call(str[key])=='[object RegExp]'){
                       continue
                   }

                   s+=('"'+key+'":"'+str[key]+'",')
                }
                s=s.slice(0,s.length-1)
                if(s==''){s+='{'}
            s+="}"
            break;
            case '[object Function]':
                s=undefined;
                break;
        }
        return s
    }
  
}