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 = "";
List<Employee> empList = gson.fromJson(empListJsonString, collectionType);
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
Post a Comment