Getting java.util.List from google JSON

import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.google.gson.stream.JsonReader;
import java.lang.reflect.Type;
import java.util.List;
import com.example.model.Employee;

String empListJsonString = "";
Gson gson = new Gson();
Type collectionType = new TypeToken<List<Employee>>(){}.getType();
List<Employee> empList = gson.fromJson(empListJsonString, collectionType);

Comments

Popular posts from this blog

How to get context path in JQuery?

How to extend Liferay 6.2 session timeout by AJAX call?