Skip to content Skip to sidebar Skip to footer

Fail When Pushing An Array Of Js Objects To Localstorage And Then Retrieving It And Parsing

I have an array of JS objects. For example: var objectList = [{phone: true},{name: 'room'}]. I need to push it to localStorage, and then retrieve this array of object and continue

Solution 1:

Probably you're storing the actual string [object Object],[object Object], thats why the parse fails. Convert the object to JSON (string) before storing it.


Post a Comment for "Fail When Pushing An Array Of Js Objects To Localstorage And Then Retrieving It And Parsing"