Created
July 23, 2013 20:32
-
-
Save bavey/6065908 to your computer and use it in GitHub Desktop.
Stringify JSON object.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var testObject = { 'one': 1, 'two': 2, 'three': 3 }; | |
// Put the object into storage | |
localStorage.setItem('testObject', JSON.stringify(testObject)); | |
console.log(JSON.stringify(testObject)); | |
// Retrieve the object from storage | |
var retrievedObject = localStorage.getItem('testObject'); | |
console.log('retrievedObject: ', JSON.parse(retrievedObject)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment