Why does saving bookmarks to json and then restoring the backup wipe all bookmarks?
Earlier today X-marks started acting up, so I backed up my bookmarks (to json as it is the default for Firefox). Then I started cleaning up to get X-marks into a good state, but only ended up with a messed up list of bookmarks. No problem, I disabled X-marks and restored my backed up bookmarks. That gave the dreaded "unable to process the backup file" error, and I tried all the steps to fix it. Deleting the places.sqlite, uninstalling and reinstalling firefox did not help (I deleted my profile before reinstalling).
In the end, I used https://github.com/andreax79/json2html-bookmarks to convert the backed up json file to html, which yielded a html file that Firefox could import. So, I tried to save the bookmarks to a json file again and then restore from that ... which caused the same "unable to process the backup file" error, wiping my bookmarks again.
I still have the html file, so I can just import that, but why on Earth is Firefox using json for backing up bookmarks if it is broken?
If it is a bug, where do I report it?
Alle svar (4)
You might already have done more research on this problem that most support volunteers.
Since the Python script worked, I assume the JSON output by the backup function was valid. (Small victory!)
The Restore feature may be sensitive to the file extension, so I definitely would stick with .json and not get creative.
My guess for what might have gone wrong as Firefox consumed the JSON is either (A) problem with the JSON parser or (B) in writing the values to the places.sqlite database some unanticipated problem arose based on the data itself (which is odd, because this data came from Firefox, but maybe its funkiness is related to why bookmarks were misbehaving before).
To search existing bugs or file new ones: https://bugzilla.mozilla.org/
When importing from a JSON file, the current data is replaced. If import an HTML file, this is added to the current data.
It sound that the JSON backup you created is corrupted because at the time you created this backup places.sqlite was already corrupted.
Do you have compressed .jsonlz4 files in the bookmarkbackups folder that you can try to restore?
The name of an automatically created JSON bookmarks backup in the bookmarkbackups folder includes a total item count (folders and separators included) and an hash value to prevent saving the same backup more than once.
- bookmarks-YYYY-MM-DD_<item count>_<hash>.jsonlz4.
@cor-el: You may be misunderstanding me.
I reinstalled Firefox, so the profile and all bookmarks were wiped. (I deleted the profile manually after uninstalling, just to be sure.)
Then I used the script mentioned above to export the json file to html and imported the html file.
If I export my current bookmarks to json and then try to import the newly exported bookmarks, I end up with no bookmarks. With a clean installation, the places.sqliete file should be in a good state?
I backed up my profile before deleting it, and while there are many jsonls4 files in it, none of them are called anything with bookmarks. Most of them are in the datareporting folder.