I\'m looking for a solution to serialize (and unserialize) Javascript objects to a string across browsers, including members of the object that happen to be functions. A typ
Something like this...
(function(o) {
var s = "";
for (var x in o) {
s += x + ": " + o[x] + "\n";
}
return s;
})(obj)
Note: this is an expression. It returns a string representation of the object that is passed in as an argument (in my example, I'm passing the in an variable named obj).
You can also override the toString method of the Object's prototype:
Object.prototype.toString = function() {
// define what string you want to return when toString is called on objects
}