Join the AMA (Ask Me Anything) with the Firefox leadership team to celebrate Firefox 20th anniversary and discuss Firefox’s future on Mozilla Connect. Mark your calendar on Thursday, November 14, 18:00 - 20:00 UTC!

Этот сайт имеет ограниченную функциональность, пока мы проводим техническое обслуживание для улучшения его работы. Если какая-либо статья не решила вашу проблему и вы хотите задать вопрос, наше сообщество поддержки ждёт вас: @FirefoxSupport в Твиттере и /r/firefox на Reddit.

Поиск в Поддержке

Избегайте мошенников, выдающих себя за службу поддержки. Мы никогда не попросим вас позвонить, отправить текстовое сообщение или поделиться личной информацией. Сообщайте о подозрительной активности, используя функцию «Пожаловаться».

Подробнее

Internal structure / specification of JSON bookmarks backup file

  • 5 ответов
  • 1 имеет эту проблему
  • 1 просмотр
  • Последний ответ от cor-el

more options

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 ...

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

Выбранное решение

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.

Прочитайте этот ответ в контексте 👍 3

Все ответы (5)

more options
more options

Thanks for your developer links, edmeister! Currently all information is helpful, since I'm totally new in using Firefox.

FrankR

more options

Выбранное решение

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.

more options

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

more options