Skip to content

Instantly share code, notes, and snippets.

@kimat
Created November 3, 2014 09:50
Show Gist options
  • Save kimat/0189b82f8901ce701430 to your computer and use it in GitHub Desktop.
Save kimat/0189b82f8901ce701430 to your computer and use it in GitHub Desktop.
// create a dictionary
var dictionary = { "key1" : "val2" };
// cast to string
var dictionary_string = JSON.stringify(dictionary);
// save in local storage
localStorage.setItem("my",dictionary_string);
// read back from local storage
var my_string = localStorage.getItem("my");
// cast back to js dictionary
var dictionary = JSON.parse(my_string);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment