export Data in localStorage for later re-import

Just an improved version of Jeremy. To simplify the process

copy('var data = '+JSON.stringify(localStorage)+';Object.keys(data).forEach(function (k){localStorage.setItem(k, data[k]);});');

Run this in console where you need to export, it copies localstorage content along with code to clipboard and just paste it in the console where you want to import.


Here's how to import/export your entire localStorage

Export

copy(JSON.stringify(localStorage));

This will copy your localStorage to your clipboard. (You need two JSON.stringify()'s to get the quotes escaped.)

Import

var data = JSON.parse(/*paste stringified JSON from clipboard*/);
Object.keys(data).forEach(function (k) {
  localStorage.setItem(k, JSON.stringify(data[k]));
});