Skip to content

Change FireFox’s default Accept header to prefer JSON over XML

April 27, 2012

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:

  1. In the address bar in FireFox, type “about:config”.
  2. Click the “I promise” button.
  3. In the search bar type “network.http.accept.default”.
  4. Double-click the setting.
  5. 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.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: