Showing posts with label HTML5. Show all posts
Showing posts with label HTML5. Show all posts

Wednesday, June 20, 2012

How to store and retrive json from localstorage.

localStorage only supports strings. Use JSON.stringify() and JSON.parse().

--save json in localstorage
var hash={};
localStorage['hash']=JSON.stringify(hash);

--retrive json from localstorage
var jsonObj=JSON.parse(localStorage['hash']);