On November 14th of 2017, Firefox 57 was released, and JSONView stopped working. This was not unexpected - Mozilla had been warning for a while that they were going to shut off their old extension system completely and move to the WebExtension system pioneered by Google Chrome. All of the Firefox extensions using the old system were silently disabled.
I had hoped to have a new version of JSONView available that was compatible with this new system before Firefox 57 released, but unfortunately the deprecation coincided with a crunch period at work and I wasn’t able to make the time. However, last month I had a chance to relax for a bit while out of town for my partner’s show at Archimedes Gallery in Cannon Beach and I took a couple hours to hack out a WebExtension version of JSONView.
I had always been hesitant to write a WebExtension version (or a Chrome version) because the way JSONView works on Firefox is that it actually intercepts the request and rewrites it into HTML. Existing Chrome ports of JSONView ran on every page load and did stuff to try and rewrite the page, imposing a cost and a security exposure to every page. However, Firefox’s implementation of WebExtensions includes StreamFilter which lets me intercept and rewrite content in the same way as I did before!
Once I had a version working on Firefox, I got something working on Chrome as well. This works differently because StreamFilter is not available on Chrome, so I use a technique that still reformats the page after it loads, but it figures out which pages to act on in a fast, safe way. Thus, for the first time, there is an official JSONView for Google Chrome. If and when Chrome supports StreamFilter, JSONView will start using it transparently, with no changes required.
There are a few bits of functionality that had to be left behind. JSONView had the option to add
application/json to your
Accept header in order to convince APIs using content negotiation to serve JSON. That turned out not to be a popular way to write APIs, and JSON has since won over XML completely, so this option isn’t as necessary. On the plus side, the method by which I detect content types that contain JSON is much more flexible now, so any content type matching
application/*+json will now work with JSONView as well - a long standing feature request.
On Firefox, you may notice that local files open in Firefox’s own JSON viewer instead of JSONView. To fix this, go to
about:config and set
JSONView remains a mature project that doesn’t need to change much, but I’m really happy that people can continue using it, and now Chrome users can get the same experience. If you don’t already have it, download JSONView for Firefox or Chrome.