Closed Bug 1236456 Opened 8 years ago Closed 8 years ago

Aurora (dev edition) incorrectly attempts to render page under the JSON viewer

Categories

(DevTools :: JSON Viewer, defect)

45 Branch
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1235118

People

(Reporter: awalgarg, Unassigned)

Details

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0
Build ID: 20151222004010

Steps to reproduce:

1. Goto https://docs.npmjs.com/files/package.json


Actual results:

1. JSON viewer fires up
2. SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data


Expected results:

1. Page should have rendered as HTML

Supposedly the JSON viewer loads up for any page where the url ends with `.json`. While I love this functionality and think it is a great addition, IMO it should be slightly stricter.

I suggest that:
- Drop the /\.json$/ rule. Many APIs have GET endpoints sending JSON *without* a `.json` at the end of the URL, and devs would like to inspect those endpoints.
- Check headers for content-type instead. So `text/json`, `application/json`.
- Add a pretty view for content-types `text/javacript; *` and `application/javascript; *` as well, since sending JSON under the JS content type is also quite popular because of JSONP. A nicely laid out code viewer (specially for JS) can provide mostly everything that the current JSON viewer provides anyways.

Just my 2 cents.
Status: UNCONFIRMED → RESOLVED
Closed: 8 years ago
Component: Untriaged → Developer Tools: JSON Viewer
Resolution: --- → DUPLICATE
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.