Here is a handy tip on how to store your JavaScript objects into HTML5 client-side storage which is basically a simple key/value hashtable. You can easily store objects into a storage in JSON format.
Code that I’m using for storing the “Task” objects in my GTD app:
var jsonTasks = JSON.stringify( tasks ); localStorage.tasks = jsonTasks;
That’s it. That is quite easy and can’t really think of many languages where you can persist objects with only few lines of code.
Code that I’m using for retrieving objects from storage:
tasks = JSON.parse( localStorage.tasks );
I hope you find this helpful. It works great on Qt Web Runtime running on my Nokia N900.
