How to deserialize a list using GSON or another JSON library in Java?

前端 未结 4 1230
半阙折子戏
半阙折子戏 2020-11-27 10:11

I can serialize a List in my servlet on GAE, but I can\'t deserialize it. What am I doing wrong?

This is my class Video in GAE, which is s

4条回答
  •  半阙折子戏
    2020-11-27 11:06

    Be careful using the answer provide by @DevNG. Arrays.asList() returns internal implementation of ArrayList that doesn't implement some useful methods like add(), delete(), etc. If you call them an UnsupportedOperationException will be thrown. In order to get real ArrayList instance you need to write something like this:

    List

提交回复
热议问题