Object.prototype.valueOf= function(){ return JSON.stringify( this ) } alert( {a:{b:2}} == {a:{b:2}} )