Hola:
La verdad es que me había olvidado del tema... y de la función toJSON(), no me gusta ese substring() para recortar la cadena... creo que más elegante sería usar un array y mostrarlo con join()
this.toArray = function() {
arreglo = new Array();
for(var i in this)
if( (typeof this[i]) != "function")
arreglo[arreglo.length] = i + ": '" + this[i] + "'";
return arreglo;
}
this.toJSON = function() {
return "{" + this.toArray().join(", ") + "}";
}
Lo puse "a capella", así que podría tener errores, y podría ser peor idea
Saludos