MozillaZine

How to open/read JSON (Firefox bookmarks) files

User Help for Mozilla Firefox
Pius
Guest
 

Post Posted January 21st, 2009, 7:25 am

The problem to restore old bookmarks in the JSON format to FF is quite wellknown here. As we're waiting for this annoying bug to be fixed it would be interesting to know how one may open these files and read their content, thus being able too see the weblinks. I have a JSON file of 165kb that I would like to explore. Question then is: anyone knows how to do this? Thanks for helping replies.

Pius
Guest
 

Post Posted January 21st, 2009, 10:09 am

Or, also how to convert the file to HTML easily. Rather no programming. Is there a pro doing the job?

mcaeby
Guest
 

Post Posted January 21st, 2009, 10:35 am

An easy way to convert the file if it is not corrupt is:
Make a "portable firefox" folder using this http://portableapps.com/apps/internet/firefox_portable
Run portable firefox (be careful to make sure it is not running your normal firefox), in there do ctrl-shift-B to open the library, under import and backup choose restore from file, from the JSON file you have.
Then in the same menu, do export to HTML.

But if you are having trouble, then there is a good chance that your JSON file is corrupt.
There is a bookmarklet at the end of this thread that can display some information from a corrupt JSON file:
viewtopic.php?f=38&t=776805&st=0&sk=t&sd=a&start=15

You have probably already tried the information here, but if someone comes by they may want to see:
http://kb.mozillazine.org/Unable_to_pro ... _-_Firefox

Pius
Guest
 

Post Posted January 21st, 2009, 7:43 pm

Thanks, did try a few things just to realize that the file is corrupt!

Would you know how to use the bookmarklet above? Do I use a HTML editor like Frontpage or just notepad to make it surface on screen? Sorry, not much into programming.

alterna

User avatar
 
Posts: 3993
Joined: January 16th, 2007, 8:27 am
Location: Big Apple

Post Posted January 21st, 2009, 7:52 pm

Just drag the .json to opened firefox window and the run bookmarklet
(create new bookmark, enter code in location)
Code: Select all
javascript:(function(){var E=document.getElementsByTagName('PRE')[0],T=E.innerHTML,i=0,r1,r2;t=new Array();while(/("uri":"([^"]*)")/g.exec(T)){r1=RegExp.$1;r2=RegExp.$2;if(/^https?:/.exec(r2)){t[i++]='['+(i)+']:<a href='+r2+'>'+r2+'<\/a>';}}with(window.open().document){for(i=0;t[i];i++)write(t[i]+'<br>');close();}})();
Thanks to dickvl
Clickable links result
Save webpage complete will save .htm
"So it goes" - Kurt Vonnegut, Jr.

Pius
Guest
 

Post Posted January 21st, 2009, 9:20 pm

Sorry for my dullness, have not been using bookmarklets before, but I think I've added it to the bookmarks toolbar now, making a new bookmark and pasting javascript code into location space.

And then, how would I drag the JSON file unto the firefox window? Into to the bookmarklet or where? Should I see result in the ff window or would I have to use other program?

Hope you bear with my unskilledness!

Thanks!

alterna

User avatar
 
Posts: 3993
Joined: January 16th, 2007, 8:27 am
Location: Big Apple

Post Posted January 21st, 2009, 9:26 pm

Save .json to desktop, drag browser window smaller from lower right edge till you can drag the .json into opened window., doubleclick titlebar to restore browser full size. In the tab that opens with .json data, click the bookmarklet. Another tab should open with links. You can save as .htm by right click "save page as" web page complete.
"So it goes" - Kurt Vonnegut, Jr.

Pius
Guest
 

Post Posted January 21st, 2009, 9:31 pm

OK, but where exactly would I drag the JSON file in the ff window?

alterna

User avatar
 
Posts: 3993
Joined: January 16th, 2007, 8:27 am
Location: Big Apple

Post Posted January 21st, 2009, 9:35 pm

Anywhere in the opened window, like dragging a shortcut or html, it'll open

You can also do File > Open File > browse to .json > open
"So it goes" - Kurt Vonnegut, Jr.

Pius
Guest
 

Post Posted January 21st, 2009, 9:37 pm

I don't know if I make something wrong, but all that shows up is an image JPEG file!

As said, I'm new to this!

alterna

User avatar
 
Posts: 3993
Joined: January 16th, 2007, 8:27 am
Location: Big Apple

Post Posted January 21st, 2009, 9:39 pm

You ARE working with a .json file, yes?

BTW an image of what? The Virgin Mary? :)

You should just get a long line starting with something like

Code: Select all
{"title":"","id":1,"dateAdded":1222235886083009,"lastModified":1223244020340428,"type":"text/x-moz-place-container","root".........................
"So it goes" - Kurt Vonnegut, Jr.

Pius
Guest
 

Post Posted January 21st, 2009, 9:56 pm

Yep, .json file. For the present working .json file it will show a result like the one you examplified above. For the corrupted however it does show a small JPEG file.

alterna

User avatar
 
Posts: 3993
Joined: January 16th, 2007, 8:27 am
Location: Big Apple

Post Posted January 21st, 2009, 10:03 pm

^Guess the operant word here is "corrupted"

Sorry, don't how to make it behave.

Good Luck. Someone with more savvy will be along. :)
"So it goes" - Kurt Vonnegut, Jr.

Pius
Guest
 

Post Posted January 21st, 2009, 10:08 pm

Here's how it looks like:

http://i377.photobucket.com/albums/oo21 ... _image.jpg

I guess there's no solution at this time, hopefully FF or some programmer finds a way to deal with these issues.

Thanks nevertheless!

alterna

User avatar
 
Posts: 3993
Joined: January 16th, 2007, 8:27 am
Location: Big Apple

Post Posted January 21st, 2009, 10:13 pm

You get that when open a bookmarks.json file in your browser!!

Forget the programmer....you need an exorcist. :shock:
"So it goes" - Kurt Vonnegut, Jr.

Return to Firefox Support


Who is online

Users browsing this forum: No registered users and 23 guests