var obj1 = {}, obj2 = {}; obj1.aaa = obj2; obj2.bbb = obj1; try { JSON.stringify(obj1); } catch(e) { alert(e); }