How to enable pretty print JSON output for Gson

Gson gson = new GsonBuilder().setPrettyPrinting().create();
	String json = gson.toJson(obj);
	System.out.println(json);

References
https://www.mkyong.com/java/how-to-enable-pretty-print-json-output-gson/

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.