Personally, we have our own class (called Json) that implements a
bunch of convenient static methods that delegate to a single Gson
instance internally. This allows us to register all of our GsonBuilder
customizations in a single place. Doing something like this would
allow you to define a simple method:
public String prettyPrint(Object o) {
return gsonInstance.toJson(o) + '\n';
> --
> You received this message because you are subscribed to the Google Groups
> "google-gson" group.
> To view this discussion on the web visit
>
https://groups.google.com/d/msg/google-gson/-/OMvZXqYMVw8J.
> To post to this group, send email to
googl...@googlegroups.com.
> To unsubscribe from this group, send email to
>
google-gson...@googlegroups.com.
> For more options, visit this group at
>
http://groups.google.com/group/google-gson?hl=en.