#This book says that to store information in several columns, you need to use json.
But why do I feel like I can just use objects directly instead of json?
I don’t understand why json is used. I hope dalao can answer:
Can I use objects? If not why?
Why use json? These three questions. Thanks
phpcn_u15822017-05-19 10:32:38
It’s not entirely correct to say it’s json, it should be json in escaped string format.
Remember, local storage can only store strings.
过去多啦不再A梦2017-05-19 10:32:38
One thing you need to always pay attention to in the original MDN article is that all data will be converted into a string through its .toString method before being saved to any of the memories to be introduced below. So a normal object will be stored as "[object Object]", not the object itself or its JSON form. It is better and more common to use the JSON parsing and serialization methods provided by the browser itself to access objects.