This article has originally been published on my employer's blog: Displaying JSON in your browser @ netresearch .
JSON, the JavaScript Object Notation, is used when communicating between web server and web application. This article gives you an insight how to modify your browser to properly display JSON content.
Inspecting JSON is part of the developer's day, and there are some obstacles you have to overcome:
- Browsers by default only display JSON as a plain text string, making it near to impossible to make sense of complex json files
- When using custom MIME types - vendor specific ones, e.g. application/vnd.foo+json - most JSON formatter addons/extensions do not detect that the data is JSON and thus do not highlight them.
This post shows you what to do to get pretty JSON with custom MIME types:
Chromium
JSONView pretty prints JSON, but falls short when you have custom MIME types. To get around that problem, you need to install application/…+json|+xml as inline - it prevents Chromium from downloading all +json and +xml MIME types.
No further configuration needed.
Firefox
JSONovich displays JSON properly and has in-built support for custom MIME types:
- Open the addon list
- JSONovich preferences
- MIME types: Add...
That's all needed.
Opera
JsonViewer highlights JSON, but Opera still asks you to download the file instead of displaying it.
You need to configure Opera to show the specific MIME type:
- Open Preferences
- Advanced
- Downloads
- Add a new one and activate "Open in Opera"