parent
cf41b9d812
commit
361ace274c
@ -0,0 +1,20 @@
|
|||||||
|
package edu.hzuapps.shudongapp;
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import com.google.gson.reflect.TypeToken;
|
||||||
|
import java.lang.reflect.Type;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import edu.hzuapps.shudongapp.bean.User;
|
||||||
|
|
||||||
|
public class JsonParse {
|
||||||
|
public static List<User> getUser (String json) {
|
||||||
|
|
||||||
|
Gson gson = new Gson();
|
||||||
|
|
||||||
|
Type ListType = new TypeToken<List<User>>(){}.getType();
|
||||||
|
|
||||||
|
List<User> users = gson.fromJson(json,ListType);
|
||||||
|
return users;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in new issue