Order
props: Object
selectedItems: Array[1]
0: SelectedItem
length: 1
__proto__: Array[0]
__proto__: Order
I have an Array of Objects “SelectedItem”.
What I need to do is Stringify the Array of objects in selectedItems to store in localstorage.
Then I would like to parse them back into objects. It seems if I use parseJSON() I get a standard object returned instead of a SelectedItem Object. Is there a proper way to do this?
No. Only object literals can be expressed in JSON, so the object you get back won’t have its previous
[[Prototype]]. It shouldn’t be too much trouble to make a newSelectedIteminstance from the returned plain object though.