I've been working on an application which involved localstorage. I've got an array of deck
type objects. The deck object itself contains card
type objects. So after looking up on how to use localstorage to store objects, I came up across this SO post:
Storing Objects in HTML5 localStorage
From what I've understood, localstorage stores data only as string, so my deck objects need be converted to a string using JSON.stringify
.
However, when I retrieve the objects from localstorage using JSON.parse
, I get an object which is not of my original user-defined type, i.e. of deck
type.
My question is so: is there a way to retrieve my objects from localstorage as objects of their original type (deck type)? Thank you in advance for your help!