Changes between Version 66 and Version 67 of pyson


Ignore:
Timestamp:
07/05/23 14:14:16 (22 months ago)
Author:
wouter
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • pyson

    v66 v67  
    136136The Deserializer requires one implemented method:
    137137{{{ deserialize(self, data:object, clas: object)}}}. It takes the json object and the expected class, and then returns  the deserialized object.
     138
     139=== {{{@JsonSerialize}}}
     140This annotation allows a custom hand-coded serializer to be used. The argument is a full.class.path of the class implementing Serializer.
     141
     142For example, {{{@JsonSerialize("test.DeserializerTest.ValueSerializer")}}}
     143
     144The Serializer requires one implemented method:
     145{{{ def serialize(self, obj:object)-> object }}}
     146
     147It takes the python object, and returns a json object (dict, list, etc) containing the serialized object.
     148
     149{{{@JsonSerialize}}} and {{{@JsonDeserialize}}} will usually come in pairs, as a custom serialization will need a custom deserialization.
     150
    138151
    139152