How to invoke default deserialize with gson

前端 未结 4 1696
隐瞒了意图╮
隐瞒了意图╮ 2020-12-25 11:57

I get a json that has \"field\" field.
If the \"field\" has data, then there is an OBJECT that has many (about 20) other fields that are also objects. I can deserialize

4条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-25 11:59

    Try using GSON >= 2.2.1 and look for the TypeAdapterFactory class.

    This will give you the ability to inspect the Object before you deserialize it and apply custom code while avoiding recursions.

    Here is an example of the getDelegateAdapter you can use.

提交回复
热议问题