Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSON Response Formatter [enhancement] #43

Open
voidstate opened this issue Sep 22, 2015 · 5 comments
Open

JSON Response Formatter [enhancement] #43

voidstate opened this issue Sep 22, 2015 · 5 comments

Comments

@voidstate
Copy link

Please add formatting/syntax highlighting for JSON responses. Currently the preview tab says: "Unable to preview this content type."

I have used HighlightJS before and can recommend it: https://highlightjs.org/

@set-killer
Copy link

Currently the preview tab says: "Unable to preview this content type."

That is because your http server does not set the correct content type header.
If you are using php you should add:

header("Content-type: application/json");

before the print of the json string.

@voidstate
Copy link
Author

Thanks for the reply but that header is already set.

rest-easy-json

@set-killer
Copy link

Ah, yea. You should try the newest version from git. If you downloaded this extension from the mozilla's site - its not the newest version and this feature is not implemented there.

@dl748
Copy link

dl748 commented Mar 14, 2016

I had the same problem, unfortunately, even the master has no support for JSON in the preview window, only if the type is text. I added some code to readyStateChange function

else if( contentType.substring(0, 16) == 'application/json' )
response['preview'] = 'data:' + contentType + ',' + encodeURIComponent(JSON.stringify(JSON.parse(request.response),null,2));

after the response['preview']. Its a ROUGH pretty print, as it doesn't have syntax highlighting.

@lguariento
Copy link

Hello,

the version on the Mozilla website is still the 2015's one, and this add-on is still not able to visualise json format. I have compiled the sources and generated the xpi, which I cannot install because it is not signed by Mozilla (yes, even toggling the xpinstall.signatures.required on the about:config). Any suggestions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants