MozillaZine


How to create a JSON file for import in FF3 *externally*?

User Help for Mozilla Firefox
wintermute101
 
Posts: 10
Joined: June 28th, 2007, 5:04 am

Post Posted January 18th, 2009, 3:12 pm

(I have to say first that while I know how to transform all kinds of text-based formats using GREP, I'm not a developer. Maybe there's still a way to solve this without becoming one. :)

I am storing all bookmarks for my various Firefox installations (Mac + Windows) in a central place - a FileMaker database (this is the way I need to do it, as this database is the source for a lot of research data - I need to use it as a starting point for bookmarks, frequently updated tables etc.).

Once a week, I export my URLs from this database (using a search/sort/export script) to a HTML file, and I import this HTML file to FF3 on the various machines.

Creating this HTML from a single-table database in FM is relatively trivial. Basically, it's:

<dt><a href=\"" & URLProtocol & URL & "\"" & ">" & URLName & "</a></dt>"

for each URL, plus a header and footer. So I weekly delete the old and re-import the new bookmarks, which works fine.

The only problem here is that this import mechanism does not support FF3's tags, which I would really like to use.

I learned that to import tags, you have to use the "Restore" command and import a JSON file.

Now what I obviously need/want to do is create such a JSON file - with all my URLs and their tags - from my FileMaker DB. This database has many fields, and one of them should act as the source for the FF tags.

But it seems that this is not as trivial as it looks.

I thought that I could just find out how a regular bookmark is stored in JSON and build a FileMaker form field like the one I made for HTML export/import.

So, as I could not find a documentation, I started poking around in a few JSON files. Now it seems that here, tags are not attributes of URLs, but rather act as "parents", with all bookmarks that have this particular tag stored as their children.

So for a bookmark "foo" with tags "bar1" and "bar2", in a JSON file from FF3 there is
- one entry for bookmark "foo"
- an entry "bar 1" with a child entry "foo"
- an entry "bar 2" with a child entry "foo".

And while I'm sure this format is awesome, it's very redundant. And I cannot create it in FileMaker, which will only spit out one entry per URL ...

So it seems I'm kind of stuck here - unless someone can give me a hint if and how I could hack around this situation and create a JSON file from my database with tags that Firefox will import.

So, in simple words:
I am looking for a way to create - in a kind of Frankenstein-ish manner - a file outside of Firefox with URLs, keywords and tags that I can import into FF3, thereby replacing the existing bookmarks completely.

But currently I feel like I am trying to re-invent the wheel here. Maybe someone has built an XSL transformation that will take a plain CSV bookmark list and transform it into a JSON file. Or there is a way to smuggle the tag(s) in for each URL or ...

Any ideas?

sempzc
Guest
 

Post Posted January 18th, 2009, 3:27 pm

If you aren't a developer, it sounds like what you want to do exceeds your skills. How do you intend to use tags, maybe you could append the tag you want to the name of each bookmark? Then the smart location bar search could find related bookmarks by just searching for that word in the title?

Return to Firefox Support


Who is online

Users browsing this forum: No registered users and 9 guests