3👍
According to the (doc), the storage value is a DOMString, and it
corresponds exactly to the JavaScript primitive String type
So if you want to save a hashmap, convert it to string with JSON.stringify
and setItem, and when you getItem, parse it back to hashmap with JSON.parse
// set
localStorage.setItem('summaries', JSON.stringify(this.summaries))
// get
this.summaries = JSON.parse(localStorage.getItem('summaries'))
Source:stackexchange.com