sviperll / adt4j

adt4j - Algebraic Data Types for Java
BSD 3-Clause "New" or "Revised" License
143 stars 8 forks source link

JSON serialization and deserialization? #22

Open meoyawn opened 9 years ago

meoyawn commented 9 years ago

I figure serialization should be pretty trivial with object mapping solutions such as Gson and Jackson

But deserialization (at least in Jackson) requires some boilerplate + some type information in the JSON tree itself (http://www.studytrails.com/java/json/java-jackson-Serialization-polymorphism.jsp)

Do you have any thoughts on this?

sviperll commented 9 years ago

I don't know the answer to your question. You can try to tinker with custom TypeIdResolvers to implement deserialization.

At first it seems easier to include required annotations to generated code, but it may be better to feather explorer the problem and try to find more extensible solution that can be adapted to other serialization frameworks...