Skip to content

Instantly share code, notes, and snippets.

@ajduke

ajduke/Ex1.java

Last active Dec 20, 2015
Embed
What would you like to do?
Gson gson = new Gson();
String json = gson.toJson(new Developer());
System.out.println("********* Compact mode ***********");
System.out.println(json);
GsonBuilder gsonBuilder = new GsonBuilder();
Gson prettyGson = gsonBuilder.setPrettyPrinting().create();
json = prettyGson.toJson(new Developer());
System.out.println("\n ******* Pretty formatting *********");
System.out.println(json);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment