class Person(mod_object.AbstractModel): name = mod_object.FieldConverter('name') family_name = mod_object.FieldConverter('familyName') age = mod_object.FieldConverter() aliases = mod_object.ObjectsListFieldConverter(Alias) main_alias = mod_object.ObjectFieldConverter(Alias, json_field_name='mainAlias') def __init__(self): mod_object.AbstractModel.__init__(self)
class Person(mod_object.AbstractModel): name = mod_object.FieldConverter('name') family_name = mod_object.FieldConverter('familyName') age = mod_object.FieldConverter() # Nonstandard deserialization the first not-null JSON element must be used: main_alias = [mod_object.FieldConverter('mainAlias.name'), mod_object.FieldConverter('aliases.0.name')] def __init__(self): mod_object.AbstractModel.__init__(self)
class Alias(mod_object.AbstractModel): name = mod_object.FieldConverter() def __init__(self): mod_object.AbstractModel.__init__(self)