You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be nice to use the JsonSerializer interface (or something similar) on
the class itself, rather than in a separate utility class which then needs to
be registered as a type adapter. In this manner, the interface would need to
look like:
JsonElement serialize(JsonSerializationContext context)
, allowing the class to use the current object's state for serialization. Gson
could reflect prior to serializing and, if it implements this interface,
delegate to it rather than do the normal class/field reflection.
A similar notion could be done for the deserialization side. This would be
similar to how Java serializable/externalizable mechanisms work.
Original issue reported on code.google.com by [email protected] on 2 Sep 2014 at 4:14
The text was updated successfully, but these errors were encountered:
With the com.google.gson.annotations.JsonAdapter annotation which was added in 2.3 (released 2014-08-11), this is already more convenient than having to register the adapters on the Gson instance.
Original issue reported on code.google.com by
[email protected]
on 2 Sep 2014 at 4:14The text was updated successfully, but these errors were encountered: