Json parsing with gson returns null object

前端 未结 2 552
终归单人心
终归单人心 2021-01-19 09:40

I am parsing a Json string via gson , this is the Json string

[
{
    \"ID\": 1,
    \"Name\": \"Australia\",
    \"Active\": true
},
{
    \"ID\": 3,
    \"         


        
2条回答
  •  面向向阳花
    2021-01-19 10:08

    Instead of List use ArrayList ?

    Gson gson = new Gson();
    Type t = new TypeToken>() {}.getType();     
    ArrayList list = (ArrayList) gson.fromJson(json, t);
    

提交回复
热议问题