#1 2023-10-12 10:53:18

spr
Member
Registered: 2023-09-12
Posts: 5

Problems when using custom reader / writer for JSON serialization and

Hello everyone,

Today, during the mORMot2 migration process, I encountered an issue related to JSON serialization and deserialization. I observed a different behavior in mORMot2 compared to mORMot1. To replicate the problem, please note that custom reader and writer procedures are registered for a class, TBase. In mORMot1, all descendants of TBase (TChild = class(TBase)) were serialized and deserialized using these reader and writer procedure. However, this is no longer the case in mORMot2. I now need to register the same reader and writer methods for each descendant.

TJSONSerializer.RegisterClassForJSON(TBase);
TJSONSerializer.RegisterClassForJSON(TChild );


TRttiJson.RegisterCustomSerializerClass(TBase,
    TBaseClassJSON.Reader, TBaseClassJSON.Writer);

//in mormot2 this is necessary
TRttiJson.RegisterCustomSerializerClass(TChild ,
    TBaseClassJSON.Reader, TBaseClassJSON.Writer);

Is this an unintended issue or an intentional change in mORMot2? It would be beneficial if the behavior in mORMot2 aligns with that of mORMot1, as otherwise, I would need to register the same reader and writer methods separately for all my descendants.

Thanks in Advance

Offline

#2 2023-10-19 07:01:05

spr
Member
Registered: 2023-09-12
Posts: 5

Re: Problems when using custom reader / writer for JSON serialization and

Hello Arnoud,

any news about this issue?

Regards
Sebastian

Offline

Board footer

Powered by FluxBB