In both the cases I get in output the content of the object:
alert(JSON.stringify(obj));
or
alert(obj.toString());
<
for an object say
obj = { a: 'a', '1': 1 }
obj.toString() gives
"[object Object]"
JSON.stringify(obj) gives
"{"1":1,"a":"a"}"
For .toString(), a default value is returned when the argument type is an object. JSON.stringify on the other hand returns JSON text, which can be converted back into a JSON object by using JSON.parse