As others have pointed out, things aren't going as planned because you are stringifying localStorage itself, as well as improperly stringifying and parsing your data.
It would be much easier just to save the object directly to localStorage and then retrieve it as needed, without having to fool around with stringifying and parsing. While these methods are necessary, all they accomplish is to convert your data into the format useable by localStorage anyway, but the data itself stays converted, that is, a float 122.55 is converted into a string "122.55" and it stays that way.
Wouldn't it be so much easier if you could directly store the number 122.55 and retrieve it that way also?
Have a look at localDataStorage, where you can transparently set/get any of the following "types": Array, Boolean, Date, Float, Integer, Null, Object or String. It seamlessly converts your data, stores it, and allows you to retrieve it just the way it went in. Store an object and get it back. Store a date and get it back. Store a number or a boolean and get those back.
Examples:
localDataStorage.set( 'key1', false );
localDataStorage.get( 'key1' ); --> false (boolean)
localDataStorage.set( 'key2', 122.55 );
localDataStorage.get( 'key2' ); --> 122.55 (float)
var obj = {
id: '159e17e9-19b7-453d-8e10-a411c7424586',
groups: '000e17e9-19b7-453d-8e10-a411c7424500'
}
localDataStorage.set( 'key3', obj );
localDataStorage.get( 'key3' ); --> {id: '159e17e9-19b7-453d-8e10-a411c7424586', groups: '000e17e9-19b7-453d-8e10-a411c7424500'} (object)
localDataStorage.set( 'key4', "this is \"something\"" );
localDataStorage.get( 'key4' ); --> 'this is "something"' (string)
All of the conversion work is done in the background for you: just set/get and go.
[DISCLAIMER] I am the author of the utility [/DISCLAIMER]
localStorage. You should stringify an object or array, and store that in localStorage. Then use JSON.parse() when you retrieve it.