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

Pretty printing #19

Open
Bixilon opened this issue May 23, 2022 · 4 comments
Open

Pretty printing #19

Bixilon opened this issue May 23, 2022 · 4 comments

Comments

@Bixilon
Copy link

Bixilon commented May 23, 2022

Why pretty printing?

( public static Gson GSON = new GsonBuilder().setPrettyPrinting().create();

I mean this is an api...that gets used by probably bots and not humans. It increases traffic and file sizes (for them, who download it). Also it affects performance.

Has this an intention?

I'd think about an extra parameter like ?pretty=true that is false by default.

@modmuss50
Copy link
Member

Yes, its easier to read, the overhead for having it is basically nothing. Having it as an option would lower the cache hit raito so would be worse imo.

@Bixilon
Copy link
Author

Bixilon commented May 24, 2022

It's not nothing, that json is ~550kb and minified around 380. That makes a difference.

But I agree, it is far more readable.

Yes, it would make caching worse, but probably not that much... Probably most people (can) use it minified.

@EliteMasterEric
Copy link

Prettifying is not needed. The bandwidth overhead is not nothing, and having the user do so when prettifying is easy.

On Visual Studio Code, it's a single keybind, and on browsers such as Firefox, a prettified view is generated automatically when receiving JSON.

@IMB11
Copy link
Member

IMB11 commented Mar 18, 2023

Chromium-based browsers will pretty print API responses in version 113

No need

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