javascript对象转字符串
function objectToString(o){var parse = function(_o){
var a = [], t;
for(var p in _o){
if(_o.hasOwnProperty(p)){
t = _o;
if(t && typeof t == "object"){
a= p + ":{ " + arguments.callee(t).join(", ") + "}";
}
else {
if(typeof t == "string"){
a = [ p+ ": \"" + t.toString() + "\"" ];
}
else{
a = [ p+ ": " + t.toString()];
}
}
}
}
return a;
}
return "{" + parse(o).join(", ") + "}";
}
页:
[1]