JSON.stringify returns "[object Object]" instead of the contents of the object
theObject.toString()
The .toString()
method is culprit. Remove it; and the fiddle shall work: http://jsfiddle.net/XX2sB/1/
JSON.stringify returns "[object Object]" in this case
That is because you are calling toString()
on the object before serializing it:
JSON.stringify(theObject.toString()) /* <-- here */
Remove the toString()
call and it should work fine:
alert( JSON.stringify( theObject ) );