Where did you install Firefox from? Help Mozilla uncover 3rd party websites that offer problematic Firefox installation by taking part in our campaign. There will be swag, and you'll be featured in our blog if you manage to report at least 10 valid reports!

Kërkoni te Asistenca

Shmangni karremëzime gjoja asistence. S’do t’ju kërkojmë kurrë të bëni një thirrje apo të dërgoni tekst te një numër telefoni, apo të na jepni të dhëna personale. Ju lutemi, raportoni veprimtari të dyshimtë duke përdorur mundësinë “Raportoni Abuzim”.

Learn More

How to display application/vnd.api+json

  • 4 përgjigje
  • 11 e kanë hasur këtë problem
  • 1 parje
  • Përgjigjja më e re nga fisharebest

more options

I'm using FirefoxDeveloperEdition on a Mac.

If a website sends me JSON data with a content-type header "application/json", then firefox displays the data using a very friendly built-in JSON viewer.

If the website sends exactly the same data, but with a content-type header "application/vnd.api+json", then firefox only knows how to save the file.

In the preferences, under "Files and applications", I can see an entry for "application/vnd.api+json" (but not "application/json").

How can I tell firefox to use its built-in viewer for responses with a jsonapi mime type?

I'm using FirefoxDeveloperEdition on a Mac. If a website sends me JSON data with a content-type header "application/json", then firefox displays the data using a very friendly built-in JSON viewer. If the website sends exactly the same data, but with a content-type header "application/vnd.api+json", then firefox only knows how to save the file. In the preferences, under "Files and applications", I can see an entry for "application/vnd.api+json" (but not "application/json"). How can I tell firefox to use its built-in viewer for responses with a jsonapi mime type?

Zgjidhje e zgjedhur

Prefix to URL with view-source: to make Firefox display the file in a tab. view-source:https://discuss.flarum.org/api/discussions?include=startUser%2ClastUser%2CstartPost%2Ctags

You can create a new bookmark and paste the JavaScript code in its location field. if you want to test this then run the JavaScript code via the command line of the Web Console.

Lexojeni këtë përgjigje brenda kontekstit 👍 0

Krejt Përgjigjet (4)

more options

A workaround is to use the view-source: protocol to force Firefox to display the file in a Firefox tab as plain text. You can use a bookmarklet to enforce the builtin JSON viewer.

javascript:location.href='data:application/json;charset=utf-8;base64,'+btoa(document.body.textContent);
more options

Hi cor-el.

Not sure how I'd use a bookmarklet, as firefox can only save the file.

Here's a public URL that generates a response with the Content-type header "application/vnd.api+json".

https://discuss.flarum.org/api/discussions?include=startUser%2ClastUser%2CstartPost%2Ctags

Typing this URL into firefox (or clicking the link) causes a dialog box to appear which gives me the option of saving the file, or opening it with another application (which also saves the file).

By contrast, here is a public URL that uses the "application/json" content type, and which is displayed within firefox.

https://jsonplaceholder.typicode.com/users

Ndryshuar nga fisharebest

more options

Zgjidhja e Zgjedhur

Prefix to URL with view-source: to make Firefox display the file in a tab. view-source:https://discuss.flarum.org/api/discussions?include=startUser%2ClastUser%2CstartPost%2Ctags

You can create a new bookmark and paste the JavaScript code in its location field. if you want to test this then run the JavaScript code via the command line of the Web Console.

more options

I have found a plugin https://jsonview.com

It is not as neat as the built-in viewer, but works for my needs.

Thanks for your help