Skip to content

Instantly share code, notes, and snippets.

@runxel
Created April 17, 2025 07:23
Show Gist options
  • Save runxel/f3ae894275ac1a1166b3d32c636791e1 to your computer and use it in GitHub Desktop.
Save runxel/f3ae894275ac1a1166b3d32c636791e1 to your computer and use it in GitHub Desktop.
Create an json export from the Firefox browser console for local storage of current website
const snapshot = {
timestamp: new Date().toISOString(),
storage: Object.fromEntries(
Object.entries(localStorage).map(([key, value]) => {
try {
return [key, JSON.parse(value)];
} catch {
return [key, value]; // Keep as string if not JSON
}
})
)
};
// Save to file
const blob = new Blob([JSON.stringify(snapshot, null, 2)], { type: 'application/json' });
const filename = `localStorage-snapshot-${snapshot.timestamp.split('T')[0]}.json`;
const link = document.createElement('a');
link.href = URL.createObjectURL(blob);
link.download = filename;
link.click();
URL.revokeObjectURL(link.href);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment