可以使用TypeToken類做到: Type fooType = new TypeToken<Foo<Bar>>() {}.getType(); gson.toJson(foo, fooType); gson.fromJson(json, fooType);.
確定! 回上一頁