How to write a custom serializer adapter for Gson that I can use with .NET?

前端 未结 1 702
忘了有多久
忘了有多久 2021-01-26 12:45

I\'ve got a .NET Rest webservice which delivers responses in Json. I consume the webservice in Java. I use Gson to serialize to and from Json.

I\'ve got problems seriali

1条回答
  •  囚心锁ツ
    2021-01-26 13:25

    Solved it by adding the following to the abstract base class so it's automatically serialized by Gson:

    private String __type = this.getClass().getSimpleName();
    

    0 讨论(0)
提交回复
热议问题