Change FireFox’s default Accept header to prefer JSON over XML
I prefer to use FireFox as my browser, but one downside is that it doesn’t display XML very well (and it seems this is a problem due to some conflict with Firebug). Now that I’m looking into WebApi more, the default content negotiation prefers to render XML due to the default “Accept” HTTP header that FireFox sends. Well, if you’d prefer to see JSON then it’s easy enough to change the default:
- In the address bar in FireFox, type “about:config”.
- Click the “I promise” button.
- In the search bar type “network.http.accept.default”.
- Double-click the setting.
- In the comma-separated list add a new value of “application/json” (without the quotes) . For me, I used “application/json;q=0.9” to lower the precedence compared to HTML.
Now when I use FireFox to view WebApi results it defaults to JSON and not XML. And with JSONView it’s easy to visualize the results.