Internal structure / specification of JSON bookmarks backup file
My current version of Firefox is 28.0.
What I already know is: - that bookmark backup files (JSON) are stored in folder "...\Mozilla\Firefox\Profiles\<xxxxx>.default\bookmarkbackups in files like e.g. bookmarks-2014-04-27_770.json (or in any other place when you backup manually).
- that bookmark export files are stored in any place as HTML (XML) in the Netscape bookmark format on your request to export.
- the main difference between these two formats is that in the HTML export file ONLY BOOKMARKS (URLs / URIs) and NO TAGS are stored.
- the JSON backup file stores bookmarks (URIs), tags and the complete tree structure. So Firefox is able to reconstruct the complete bookmark menu with all its information.
I am doing a lot of info research in the internet. To support a sophisticated work with hundreds or even thousands of collected boomarks tags are absolutely necessary. And I have often export bookmarks with tags to other browsers or social bookmark sites. So I have no idea why firefox does not support tags in export files - since a large amount of bookmarks without tags is not manageable.
My idea is to program a tool or an extension that reads a JSON backup file and constructs a HTML export file which also contains tags.
The problem is that the internal structure of the JSON backup file is rather complex. Actually it contains "id", "index", "parent" information (all numeric) which makes it possible to reconstruct the original tree structure. Even information on tags is somehow linked to the bookmarks. Actually the file has a complicated structure of lists and trees. And don't think that there are any identifier, e.g. "tags" which precedes a list of tags attached to a bookmark (like in HTML exports). Actually I could identify some of my tags in the file, but they are not named e.g. with "tag" - I could identify them because I knew that they are some of my defined tags, but a program doesn't have this information and needs a general way to identify tags in the file. Currently I don't know any way to do this!
Is there anybody who has a better understanding of the structur of this file or know a specification that could be find somewhere? So many thans in advance ...
FrankR2014 moo ko soppali ci
Saafara biñ tànn
Tags basically have this structure if you search the bookmarks JSON backup for tags:
{ 'title': 'Tags', 'type': 'text/x-moz-place-container', 'root': 'tagsFolder', 'children': [ { 'title': '<tag title>', 'id': <tag id>, 'type': 'text/x-moz-place-container', 'children': [ { 'title': '', 'id': <id of child>, 'parent': <parent id>, 'type': 'text/x-moz-place', 'uri': 'http://', 'charset': 'UTF-8' },{ <more children> } ] },{ <more children> } ] },
Note that easiest to inspect a JSON backup is to open the file in the Scratchpad and click the pretty print button to make Firefox show the file formatted.
Jàng tontu lii ci fi mu bokk 👍 3All Replies (5)
The Mozilla Developer Network website is the place to look for documentation.
https://developer.mozilla.org/en-US/
https://developer.mozilla.org/en-US/search?q=JSON&topic=addons&topic=webdev&page=1
https://developer.mozilla.org/en-US/docs/Places_Developer_Guide
https://developer.mozilla.org/en-US/docs/JSON
https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIJSON
Thanks for your developer links, edmeister! Currently all information is helpful, since I'm totally new in using Firefox.
FrankR
Saafara yiñ Tànn
Tags basically have this structure if you search the bookmarks JSON backup for tags:
{ 'title': 'Tags', 'type': 'text/x-moz-place-container', 'root': 'tagsFolder', 'children': [ { 'title': '<tag title>', 'id': <tag id>, 'type': 'text/x-moz-place-container', 'children': [ { 'title': '', 'id': <id of child>, 'parent': <parent id>, 'type': 'text/x-moz-place', 'uri': 'http://', 'charset': 'UTF-8' },{ <more children> } ] },{ <more children> } ] },
Note that easiest to inspect a JSON backup is to open the file in the Scratchpad and click the pretty print button to make Firefox show the file formatted.
Many, many thanks to cor-el !!!
If I had seen these identifiers in the JSON bookmark backup before, I had no problem at all! All I needed was ... 'title': 'Tags', 'type': 'text/x-moz-place-container', 'root': 'tagsFolder', ...
But I didn't find anything like this! OK, a text beautyfier may be helpful to read the text by a human - but even the search function had its problems to find strings like "tag" - actually it didn't find a single occurance. And the file's overall complexity and redundancy of the makes additional problems without a specification.
In my original posting I even claimed that there were no identifiers like "tags" in the file. This was, of ourse, wrong! I just didn't see them!
Now I have all I need! I'm going to apply the Java EE JSON-API (available since Java EE 7) to read in a JSON bookmark backup and translate it to XML to import it everywhere I need (with bookmarks and tags!).
By the way: Do you know the meaning of the following identifiers - "GUID", e.g. "guid":"HD8o3potRm_A", "flags":0, "expires":4 ?
FrankR
FrankR2014 moo ko soppali ci
See the comments in this file about the annotations: