Show errors as JSON if application/json is in Accept (bug 1013440)

https://bugzilla.mozilla.org/show_bug.cgi?id=1013440