📜  将 json 转换为 arraylist java - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:17.510000             🧑  作者: Mango

代码示例2
// Top of file
import java.lang.reflect.Type;

// ...

private void parseJSON() {
    Gson gson = new Gson();
    Type type = new TypeToken>(){}.getType();
    List contactList = gson.fromJson(jsonString, type);
    for (ContactModel contact : contactList){
        Log.i("Contact Details", contact.id + "-" + contact.name + "-" + contact.email);
    }
}