When an object originates from a different window than the one the JSON object belongs to, then undefined is returned as the result of JSON.stringify(object).
The code executed by the button below is
function serialize(data){
output.innerHTML = JSON.stringify(data);
}
serialize({a:'a',b:'b'});