Without Book Interview Questions and Answers | Online Test | Moct Test
Download Android App in your Android Device from Google Play Store
- Search for "Withoutbook Practice Exam Test" in Mobile/Tablet Play Store
Institute Training Search by Name or Email

Exams Attended

Make Homepage

Bookmark this page

Subscribe Email Address

Google Gson Interview Questions and Answers

Ques. How to provide Pretty Printing for JSON Output Format?
The default JSON output that is provide by Gson is a compact JSON format. This means that there will not be any white-space in the output JSON structure. To generate a more readable and pretty looking JSON use setPrettyPrinting() in GsonBuilder.

Gson gson = new GsonBuilder().setPrettyPrinting().create();
String jsonOutput = gson.toJson(employee);

  "id": 1,
  "firstName": "Lokesh",
  "lastName": "Gupta",
  "roles": [
  "birthDate": "17/06/2014"
Is it helpful? Yes No

Most helpful rated by users:

©2016 WithoutBook