DEcompressed jsonlz4
I lost some downloaded files over the weekend when I noticed that Windows Explorer was not finding files under search. So I found out how to fix Windows Explorer by deleting a bin file, then a System Restore and I thought the problem was solved. However, the files I had saved were gone. I found them under a Windows Explorer search based on the date restored them but I had two FireFox windows up when I did this. I brought up the downloaded files under History but WE did not show the files. So I restarted the two FF sessions and the the files were no longer in my history. I tried to Import the files to IE 9.0 but IE9.0 will not process the jsonlz4 and I can't upgrade to IE10 because of System Requirements. I've backup up my bookmarks and tried to restore these jsonlz4 with no effect. I found a post from a year ago, "Is there a way to convert the compressed jsonlz4 files to json?", but that shows to use the Browser Console which it appears I would have to learn Java. I could do this if I had the time since I have a BSCS from 1994 but the two jsonlz4 files are less the 30kbs. I've copied the jsonlz4 files to another temporary directory under where I save my bookmarks and I would like to know if there is a program to decompress jsonlz4 to json so I can transfer and read these files temporarily under IE9? However I Just tried uploading the files but as it states it only accepts "Uploaded images".
All Replies (7)
You can only use Firefox to use a compressed .jsonlz4 file or decompress the file for inspection. The code you referred to is not about Java but is about JavaScript and needs to be used on the command line of the Browser Console ("3-bar" menu button or Tools > Web Developer).
You need to toggle devtools.chrome.enabled to true on the about:config page to enable the command line in the Browser Console.
Paste the JavaScript code in the command line. Press the Enter key to evaluate the JavaScript code.
If Firefox can't decompress the file then the file is damaged or otherwise not compatible with the current release.
I would have to study how to use the console and besides that I have FF 45.0.1. Your reference to the page "developer.mozilla.org/Tools/Browser_Console" showed "toggle devtools.chrome.enabled to true" "Enable browser chrome and add-on debugging toolboxes" (Firefox 40 and later)" from where? I remember taking C and C++ so it is not a totally alien language but this requires a study. Computer Science languages are exact and there is no room for error. I need a command line syntax and point by point reference to input command line parameters.
All the related tools are designed to help with Firefox and website problems. There is quite a bit of related documentation including screenshots and tutorials if you browse from
Why not simply either from your own memory, or from Firefox's history revisit the download site and get fresh copies of the files. What makes you think Firefox should be able to open the Files anyway ?
The jsonlz4 files have that info and that is what I am trying to recover. So now I have to study or browse in the middle of a language for the exact syntax to decompress a jsonlz4 file?
If you wish to display the content of the files you could try a viewer addon
- JSONView 1.1.0 https://addons.mozilla.org/firefox/addon/jsonview/
I note there is a review saying it may no work on Ubuntu 14.04, I have Ubuntu 14.04 but have not tested it on that. It does work on the current machine though.
Of course if the files in question are Firefox bookmark backups simply create a new profile and restore the bookmarks there. You could then look at the resultant places.sqlite with a sqlite viewer to see the full content and structure or export most of the content as a user friendly HTML that could be imported into or viewed in an alternative browser.
You may also be interesting reading
- Bug 818587 - Compress bookmark backups https://bugzilla.mozilla.org/show_bug.cgi?id=818587#c47
(In reply to orionbelt2 from comment #46)
> I was wondering whether, more than a year after the above words were
> written, there is any progress with providing a stand-alone (i.e., that can
> be run independently/outside of Firefox) .jsonlz4 decompressor.
not a priority. It will happen when possible.
> I would also be curious to know the rationale behind compressing to a
> non-standard format, i.e., a format that the standard lz4 program cannot
> decompress due to an "Unrecognized header" error.
It's the best compression API we had at the time (and still now).
Please do not comment in bugs. See bugzilla etiquette
Update. More info on how to decompress .jsonlz4 https://www.reddit.com/r/firefox/comments/2ps6wg/jsonlz4_bookmark_backups/
John99 দ্বারা পরিমিত
It is just a matter of opening the about:config page via the location/address bar like you open a website and you its search bar to locate the devtools.chrome.enabled pref and sets its value to true with a double-click if its current value is false (default).
Then if you open the Browser Console then you should see a command line at the bottom of the Browser Console window. On this command line you can paste the code to decompress the compressed .jsonlz4 file and press the enter key to evaluate (run) this JavaScript code. There is no need to fully understand how this code works. The below posted code when evaluated in the Browser Console will open a file picker window that allows to browse to a compressed .jsonlz4 and select this file for decompression. It will show a message to what file the decompressed file has been saved.
var {classes:Cc,interfaces:Ci,utils:Cu} = Components; var fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker); fp.init(window, "Open File", Ci.nsIFilePicker.modeOpen); fp.appendFilter("Bookmark Backup Files", "*.jsonlz4"); if (fp.show() == Ci.nsIFilePicker.returnOK) { var file = fp.file; if (file.exists() && file.isFile() && file.isReadable()) { var oldFile = fp.file.path; var newFile = oldFile.replace(".jsonlz4", ".json"); Cu.import("resource://gre/modules/Task.jsm"); Cu.import("resource://gre/modules/osfile.jsm"); function decompressBookmarksFile(oFilePath,nFilePath){return Task.spawn(function* () {var jsonString = yield OS.File.read(oFilePath,{ compression: "lz4" });yield OS.File.writeAtomic(nFilePath, jsonString);})} decompressBookmarksFile(oldFile,newFile); console.log("Saved as: "+ newFile); } }