import com.google.gson.Gson; public class App { public static void main(String[] args) throws Exception { Employee emp = new Employee("Csendes Imre", "Szeged", 342); Gson gson = new Gson(); System.out.println(gson.toJson(emp)); } }