Archive for the ‘JSONView’ Category

JSONView 0.4 with content negotiation

JSONView 0.4 was just approved on addons.mozilla.org. This one is mostly a bugfix release from 0.3, but I couldn’t let it go out without one new feature, so I finally added support for content negotation. This means that you can go to the new JSONView options dialog (in the Addons menu) and enable sending the “application/json” content type with your HTTP Accept header. Some applications (like some Ruby on Rails websites) are set up to return JSON if you ask for it via the HTTP Accept header, and XML or HTML otherwise. This means thay you can now specify a preference for JSON, which should help when you’re in that situation. I specifically made sure it works with CouchDB, which is an exiting document-based database with a JSON API. Before this option, CouchDB would return plain text to browsers, but now you can make it send JSON that’ll be nicely formatted by JSONView. Note that the option to modify the HTTP Accept header isn’t on by default because many people won’t need it, and it has the potential to screw up some websites that don’t expect browsers to ask for JSON. That said, I’m sure this will be helpful in a bunch of situations.

JSONView Options

On the bugfix side, I fixed the issue I mentioned in my post about JSONView 0.3 where values that were 0 or false wouldn’t show up at all as a result of some overzealous error-checking. I also hunted down an infuriating bug where JSON documents would sometimes report as invalid when Firebug was on. This took a while to track down, but apparently Firebug slows down the loading of the document enough to mess with how I was reading a stream (and I had to be careful not to re-trigger an earlier bug that could cause Firefox on OSX to crash.) Anyway, it’s fixed now, and everybody should see more reliable document rendering, Firebug or not. For those living on the edge, JSONView is also marked as compatible up to Firefox 3.7a1pre, so you should have no trouble installing it on Minefield or the upcoming Firefox 3.6 alpha.

One thing that might stand out is that the new options dialog might not be localized for your language. JSONView’s localizations are handled by the generous volunteers at Babelzilla, which is great for me, but not as great when I want to rush out a release with important bugfixes. In this case I chose to ship 0.4 before all the new localizations had arrived, but I’ll add them all in again for the next release once the translators have caught up.

So grab JSONView 0.4 from addons.mozilla.org, or just update your extensions if you’ve already got it installed. As usual, feel free to send me feedback as comments on this post, and file bugs and feature requests at Google Code.

Updates to JSONView, XBList, and TopProcess

I’ve finally gotten around to doing some maintenance updates on three of my most-used bits of software (JSONView, XBList, and TopProcess), all in the last couple weeks. Now that they’re all approved and live, I thought I’d summarize what’s changed.

JSONView 0.3

JSONView 0.3 is now available at addons.mozilla.org. This fixes an error that was showing up when really large JSON files were being displayed, and adds a feature that displays empty arrays and object on one line instead of on two (and doesn’t display the expand/collapse button for them). I also put in some preliminary support for JSONP, based on a patch submitted by Gabriel Barros. The catch is that it only works with content served with the “application/json” MIME type, which is actually not the correct MIME type for JSONP – it should be “text/javascript” or another JavaScript type. Unfortunately I haven’t been able to figure out how to get Firefox to let me handle “text/javascript” the way I do with “application/json” – it seems to be special-cased or something. If any Firefox gurus are reading and know a solution, please let me know! I was holding onto this release for a while hoping to fix that, but I decided that releasing something was better than nothing, so it’s out there and you can play with it. You can see an example JSONP response with the callback highlighted here. I did notice a bug with the 0.3 release right after it was approved – if a value is 0 or false, it shows up as blank. I’ll have that bug fixed with the next release, which should be very soon. It’s great to see that JSONView has become so popular, with over 50,000 downloads and about 12,000 regular users.

XBList 3.2.4

Halo 3: ODST was released a couple weeks ago, and Bungie redesigned their site a bit to include ODST info in your Service Record. This included changing the pages just enough that XBList got confused trying to figure out emblems for people who had never played Halo, and started showing the wrong emblems for those people (only if you prefer Halo emblems to Xbox emblems, which isn’t the default). Not a huge bug, but I took the opportunity to clean up a bunch of stuff in XBList and put out a little release. In addition to the Halo emblem fix, I fixed a bug where your settings could get corrupted and you wouldn’t be able to start XBList. I also cleaned up the menus and settings, consolidating the Halo links into one item, and removing the option to choose a custom notification sound or turn off debug logging. The debug log is much easier to get to if you’re having trouble – previously I had people dig through their Application Data folders for the log, but now there’s an item in the Help menu that opens the debug log directly. Paired with some much more detailed logging, I should be able to fix future problems much more easily. I also changed the system tray icon to bring XBList to the front on a single click rather than a double click, since that feels much more natural in Windows 7. Lastly (and probably not too importantly for most people), I’m storing emblems in your local Windows profile now, instead of the roaming profile. For the few people who use XBList and have roaming profiles enabled, this should save you some sync time. Anyway, you should have been prompted to update when I pushed the update two weeks ago, but if you haven’t gotten it yet you should download and install it now. I still have plans for a major overhaul of XBList, but it’s low on my list of priorities – XBList is still pretty popular, but not as much as it used to be, with maybe 5,000 active users.

TopProcess 1.4

This last update has been a long time coming. Ever since I installed Internet Explorer 8, the TopProcess sidebar gadget has been randomly crashing. I’m not sure what changed in Internet Explorer to make it screw up every so often, but it does. However, it only crashes after running for a few days, so for months I’ve been tweaking the code a bit, then waiting until it crashes, then tweaking some more, rinse, repeat. I’ve finally nailed it down to the point where crashes are very rare, and then I added some code that automatically resets the gadget when it crashes. So you should never see it mess up again. There is also a gadget log file in the gadget’s install directory that I’m using to store errors, so it should be easier to troubleshoot in the future. Lastly, Jean-Pierre van Riel contributed a patch that added IO tracking to TopProcess, so there is now a third way to view your processes. This view shows you the total IO usage (combined bytes in and out, per second) which seems to cover both disk and network access. Get the update from me or from Windows Live Gallery and be sure to rate the gadget. I’m excited to see that it’s been downloaded over 100,000 times from WLG (plus who knows how many downloads from my site).

JSONView 0.2 adds support for opening local .json files

Just a quick update on JSONView – I’ve submitted version 0.2 to addons.mozilla.org. This new version doesn’t have a lot of changes, but it adds some new translations (Hungarian, Bulgarian, German, and some Turkish), and you can now open “.json” files saved on your computer, enabling offline JSON viewing. This new version is also compatible with the latest Firefox 3.5 betas.

Of course, the extension must be reviewed before this new version can be released from the sandbox, but if you want to try it out you can download version 0.2 from the sandbox. Hopefully it’ll be approved soon and will show up on the main extension listing. Please give it a look and rate and review the extension on addons.mozilla.org.

I’ll be out of the US on vacation until next month, but after that I intend to do some more work on the feature backlog for JSONView, as well some updates to other projects. Remember you can vote on features or file new ones at the Google Code issue tracker for JSONView.

JSONView Updated to 0.1b3

Today I uploaded a new version of JSONView to addons.mozilla.org. I’m sticking with the wimpy version number for now, but I think JSONView has been proving itself out in the wild. One major bug was uncovered that caused JSON documents larger than 8KB to render incorrectly, and that’s fixed in this new version. I’ve also added three new translations of the extension (French, Dutch, and Czech) courtesy of the folks at BabelZilla.org – if you want to help out you can check out the available translations and add yours. Lastly, the extension is now compatible with Firefox 3.1b3. I’ve been trying to keep things tested on the beta browsers within a day or two of their release. If you have an older version of the extension you’ll need to go back to AMO and install it again – automatic updates won’t work until JSONView is out of the sandbox.

JSONView has gotten a bit of coverage on the blogs, too, which I’ve enjoyed. It made it onto the front page of Delicious and reddit programming, and Ars Technica wrote an article in their journals. Also, I was interviewed on OpenSource Release Feed, which was fun. I’m glad that people are getting to use the extension and find it helpful. Hopefully when it gets released from the sandbox it’ll get even broader exposure.

JSONView – View JSON documents in Firefox

I’m a big fan of JSON as a data exchange format. It’s simple, lightweight, easy to produce and easy to consume. However, JSON hasn’t quite caught up to XML in terms of tool support. For example, if you try to visit a URL that produces JSON (using the official “application/json” MIME type), Firefox will prompt you to download the file. If you try the same thing with an XML document, it’ll display a nice formatted result with collapsible sections. I’ve always wanted a Firefox extension that would give JSON the same treatment that comes built-in for XML, and after searching for it for a while I just gave up and wrote my own. The JSONView extension (install) will parse a JSON document and display something prettier, with syntax highlighting, collapsible arrays and objects, and nice readable formatting. In the case that your JSON isn’t really JSON (JSONView is pretty strict) it’ll display an error but still show you the text of your document. If you want to see the original text at any time, it’s still available in “View Source” too.

JSONView logo

I’ve been eager to release this for some time, but I finally pushed it to addons.mozilla.org last night. I actually started development on it about 7 months ago, but work got paused on it for about 6 months due to stuff out of my control, and then I had some other projects I was working on. The actual development only took a few days (including digging through some confusing Unicode bugs). I thought it was funny that right as I was resuming work on JSONView I noticed that a JSON explorer had actually landed for Firebug 1.4, which I’ll also be looking forward to. Initially I had intended to build that functionality as part of my extension. There’s a lot I’d like to add on, like JSONP support and a preference to send the “application/json” MIME type in Firefox’s accept headers.

This is actually my first real open source project – I’ve released some code under open source licenses before, but this is actually set up at Google Code with an issue tracker and public source control and everything. I’ve licensed it under the MIT license. I’m really hoping people get interested in improving the extension with me. I’ve pre-seeded the issue tracker with some known bugs and feature requests.

The extension itself is pretty simple. I wasn’t sure how to approach the problem of supporting a new content type for Firefox, so I followed the example of the wmlbrowser extension and implemented a custom nsIStreamConverter. What this means is that I created a new component that tells Firefox “I know how to translate documents of type application/json into HTML”. And that it does – parsing the JSON using the new native JSON support in Firefox 3 (for speed and security) and then constructing an HTML document that it passes along the chain. This seems to work pretty well, though there are some problems – some parts of Firefox forget the original type of the document and treat it as HTML, so “View Page Info” reports “text/html” instead of “application/json”, “Save as…” saves the generated HTML, Firebug sees the generated HTML, etc. Just recently I came across the nsIURLContentListener interface, which might offer a better way of implementing JSONView, but I’m honestly not sure – the Mozilla documentation is pretty sparse and it was hard enough to get as far as I did. I’m hoping some Mozilla gurus can give me some pointers now that it’s out in the open.

Right now the extension is versioned at “0.1b1″ which is a wimpy way of saying “this is a first release and it could use some work”. It’s also trapped in the “sandbox” at addons.mozilla.org, where it will stay until it gets some downloads and reviews. Please check it out, write a little review, and soon people won’t have to log in to install it!

Note: While composing this post I ran across the JSONovich extension which was apparently released in mid-December and seems to do similar stuff to JSONView. No reason we can’t have two competing extensions, though.