Q:

express js session is serialized incorrectly

I use node.js and expressexpress.
I add a dictionary to the req.session. It appears that the value inside the dictionary does not saved ()between cleints calls) 
I will really appreciate any solution.
'req.session.test = [];
'req.session.test["obj1"] = obj; // Does not save in the session! - disappears between client calls'
'req.session.test.push(obj);     // saved in the session and can be found between client calls'

Thanks in advance,
Shai

A:

You cannot add objects to an array like that. If you want named keys (a "hash") then you'll have to use an object. Try
req.session.test = {};
req.session.test["obj1"] = obj;

