if(o = = undefined ){
返回“”;
}
var r =【】;
if(type of o = =“string“)return“\“+o . replace(/(【\“\ \】)/g“\ \ $ 1“)。替換(/(\ n)/g,“\\n“)。替換(/(\ r)/g,“\\r“)。replace(/(\ t)/g,“\ \ t“)+“\“;
if(type of o = =“object“){
如果(!o.sort)
for(變量i in o)
r . push(“\“+I+“\“:“+fn。obj 2 str(o【I】));
如果(!!document.all && amp!/^\n嗎?function \ s * toString \(\)\ s * \ n?\s*\【本機代碼\】\ n?\s*\}\n?\s*$/。測試(o . tostring)){
r . push(“toString:“+o . toString . toString());
}
r =“{“+r . join()+“}“
}否則{
for(var I = 0;我& lto .長度;i++)
r . push(fnobj 2 str(o【I】))
r =“【“+r . join()+“】“;
}
return r;
}
return o.toString()。replace(/\“\:/g,““:“““);
}