google gson LinkedTreeMap class cast to myclass

后端 未结 5 829
时光取名叫无心
时光取名叫无心 2020-11-29 05:01

I knew this question has been asked before. Due to my novice skill in java and android. I can\'t resolve this issue for more than a week.

One of my friend and i dev

5条回答
  •  生来不讨喜
    2020-11-29 05:30

    import
    import com.google.gson.Gson;
    import com.google.gson.reflect.TypeToken;

    Code
    String json = new Gson().toJson("Your Value");
    ArrayList outputList = new Gson().fromJson("Receive Value", new TypeToken() { }.getType());

    Log.d("TAG", outputList.get(0).getName);

提交回复
热议问题