use of com.gpcoder.gson.object.Student in project Java-Tutorial by gpcodervn.
the class SerializedNameExample method main.
public static void main(String[] args) {
final GsonBuilder builder = new GsonBuilder();
final Gson gson = builder.create();
final Student student = new Student(1, "GP Coder", "Java Dev");
final String json = gson.toJson(student);
System.out.println("Json: " + json);
final Student student2 = gson.fromJson(json, Student.class);
System.out.println("Java Object: " + student2);
}
Aggregations