Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Is there a Chrome plugin that renders JSON files in Chrome? Currently Chrome just tries to download them, and that's kind of boring.

share|improve this question

6 Answers 6

up vote 6 down vote accepted
+100

Apparently, some time ago someone asked how to build such an extension on the Chromium-extensions Google group, and the answer was that it's not yet possible.

More recently, someone else asked the same question again - so, it looks like it won't take long for such an extension to appear, as soon as API support is implemented.


Meanwhile, if you're really bothered by this and you can install a local proxy (Fiddler2, for example), you could try to make it change the Content-Type header for all responses where it is "application/json" to "text/plain" - and do it only for Chrome page requests. This will trick Chrome into showing you a plain text view of the JSON data, instead of trying to download it. Be careful, though: this could break some web applications which expect the "application/json" content-type.

To implement this with Fiddler, just choose "Customize Rules" from Fiddler's "Rules" menu, and when the CustomRules.js file opens, add this variable to the beginning of the Handlers class:

class Handlers
{
    // You have to add these two lines
    public static RulesOption("Show JSON data as plain text in Chrome")
    var m_JSON2Text: boolean = false;

And then add, at the end of the OnBeforeResponse method, just before the closing bracket:

    if(m_JSON2Text) {
        var isJson = oSession.oResponse["Content-Type"].indexOf("application/json") != -1;
        var isChrome = oSession.oRequest["User-Agent"].indexOf("Chrome") != -1;
        if(isJson && isChrome) {
            oSession.oResponse["Content-Type"] = "text/plain; ";
        }
    }
    // Next is the closing bracket. Add all lines preceding this comment
}

This will add an item named "Show JSON data as plain text in Chrome" to Fiddler's "Rules" menu, which you'll be able to turn on/off, triggering/disabling the required behaviour.

The overhead is having to keep Fiddler2 running while browsing. If that will or will not be noticeable depends, of course, on your hardware/software configuration.

share|improve this answer
6  
So what you're saying is that I should use firefox, right? –  stevedbrown Dec 14 '09 at 20:35
    
Well, since configuring Fiddler is arguably a bit overkill for this single purpose, then yes, right now the only solution would be to change your browser. Note that the default behaviour will, in most browsers, remain the same - it's just that you'd be able to tweak them somehow to manage JSON files. Firefox does it with a number of different extensions (for example, JSONView and JSONovich). Opera makes it even simpler: just open "Preferences -> Advanced -> Downloads" and add a new "application/json" MIME type, choosing to open it "with Opera". –  TataBlack Dec 14 '09 at 22:08
    
There's also a highly awesome plugin for viewing JSON in Fiddler. –  Kevin L. Aug 25 '10 at 19:59
1  
Please have a look at the other answers: In the meantime, “JSONView” and “Pretty JSON” are available. I like JSONView better, but have a look at both. –  scy Aug 22 '11 at 17:10

To display JSON URLs that are served with a custom (vendor) MIME type, you may use JSONView 0.0.32 together with application/...+json|+xml as inline 0.0.2.

share|improve this answer

JSONView for chrome

  • In-browser viewer
  • Expand and contract JSON items
  • Format validation
  • Doesn't require .json ending

Enable:

Chrome wrench button >> Tools >> Extensions >> "Allow access to file URLs"

share|improve this answer

IE and Firefox are JSON capable but not Chrome.

I'm developping in Javascript and PHP and I MUST use JSON to read a PHP array from Javascript. There is no other way to get this working.

So, I'm waiting for Chrome being compatable.

share|improve this answer
1  
Just because Chrome can't show JSON files, doesn't mean that it's not capable of working with them. –  Bobby Nov 11 '10 at 11:07

FYI there's now also a more polished extension, Pretty JSON: https://chrome.google.com/extensions/detail/ddngkjbldiejbheifcmnfmmfiniimbbg

share|improve this answer

I got impatient waiting for a new Chrome API and ported JSONView just using simple regex matching.

http://github.com/jamiew/jsonview-chrome

This is a rough draft, but it works! You can install it using "Load unpacked extension" from the chrome://extensions -- working out some kinks but will package it as a real extension soon.

For further prettification checkout the "XML Tree" extension (SuperUser won't let me post 2 links yet)

share|improve this answer
2  
Now this is a real Chrome extension and works great: chrome.google.com/extensions/detail/… –  Sebastian Hoitz Aug 17 '10 at 9:42

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.