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

Prettify JSON #19

Closed
ameenross opened this issue Jun 5, 2014 · 5 comments
Closed

Prettify JSON #19

ameenross opened this issue Jun 5, 2014 · 5 comments

Comments

@ameenross
Copy link

Would be cool if JSON could be prettified. IMO it makes sense to do so in the "preview" tab.

This:

{"parameter1":"value1","parameter2":"value2"}

should become this:

{
    "parameter1": "value1",
    "parameter2": "value2"
}
@mikegioia
Copy link

I just submitted a pull request for this: #24

@set-killer
Copy link

Since the pull request of @mikegioia is outdated, i've tryed to implenet the json preview.
Everything looks fine but i have a hard time using the localization strings.
Here is everything i have made for now:
https://github.com/set-killer/REST-Easy/commit/ca3e2f7ed6aa99d4d1a59e9bc57a4913693b7d67

@nathan-osman could you please give me support on this localization strings?
They are just 2 strings that can't call inside resteasy.html and application.js
response.jsonn.title
response.jsonn.error
If you have any other remarks on the code, please tell me to fix them. Then i can make pull request.

@nathan-osman
Copy link
Owner

To answer your first question, you can access localized strings using:

tr(string_name)

For example:

var username = tr('request.auth.username');

However, I'm not sure that adding a new tab is the best way to present the prettified JSON. The Raw tab is supposed to display the content exactly the way it was received over-the-wire. The Preview tab would probably be a more appropriate place to display the prettified JSON.

@set-killer
Copy link

Thank you for the comment. That way it was much easier to implement. I've tryed to keep the code consistent.
The pull request is here:
https://github.com/nathan-osman/REST-Easy/pull/33/files

If there are is anything that i have to change on the code, please tell me to fix it.

@nathan-osman
Copy link
Owner

Looks good, thanks!

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