this function converts an object into a string, using it to strengthen the object and then add it to the cookie.
function JSONToString(Obj){
var outStr ='';
for (var prop in Obj) {
outStr = '{';
if (Obj.hasOwnProperty(prop)) {
if(typeof Obj[prop] == 'object'){
outStr += JSONToString(Obj[prop]);
} else {
outStr += prop + ':' + Obj[prop].toString();
}
}
outStr += '}';
}
return outStr;
}
source
share