IvanConrad / google-gson

Automatically exported from code.google.com/p/google-gson
0 stars 0 forks source link

JsonWriter to offer control over when to newline #455

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. I find there are too many newlines in pretty printing, I prefer the style 
from http://jsbeautifier.org/
2. Provide setters for controlling if newline is output between array elements.

What is the expected output? What do you see instead?

No newline is output between array elements.

What version of the product are you using? On what operating system?

Gson 2.1 on Windows 7 64-bit with Oracle Java 1.6.0_31.

Original issue reported on code.google.com by garydgre...@gmail.com on 26 Jun 2012 at 12:12

GoogleCodeExporter commented 9 years ago
We used to have a lot of heuristics for this, including line wrapping long 
lists and such. The current behavior is much simpler, and still pretty readable.

Original comment by limpbizkit on 30 Jun 2012 at 2:50

GoogleCodeExporter commented 9 years ago
Ok, but I cannot subclass JsonWriter because some of the calls to newLine() I 
want to avoid are made from private methods. Are you saying I need to clone 
JsonWriter?

Thank you,
Gary

Original comment by garydgre...@gmail.com on 30 Jun 2012 at 6:53