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

RESOLVED DUPLICATE of bug 1235118

Status

()

Firefox
Developer Tools: JSON Viewer
RESOLVED DUPLICATE of bug 1235118
2 years ago
2 years ago

People

(Reporter: awalgarg, Unassigned)

Tracking

45 Branch
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

2 years ago
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.

Updated

2 years ago
Status: UNCONFIRMED → RESOLVED
Last Resolved: 2 years ago
Component: Untriaged → Developer Tools: JSON Viewer
Resolution: --- → DUPLICATE
Duplicate of bug: 1235118
You need to log in before you can comment on or make changes to this bug.