November 2017
Intermediate to advanced
420 pages
10h 29m
English
Gson has simplified APIs to convert the object model into the JSON content. Depending upon the type of the object model, you can use either of the following APIs to get the JSON representation:
// Get Employee object that needs //to be converted into JSON Employee emp=getEmployee(); Gson gson = new Gson(); // create JSON String from Object String jsonEmp = gson.toJson(emp);
//Get Employee list that needs to be converted into JSON List<Employee> employees= ...