#1 2012-05-03 19:02:42

From: France
Registered: 2010-06-21
Posts: 13,648

Custom JSON serialization of records

By default, during interface-based service call, any record parameter or function result will be serialized with our proprietary binary (and optimized layout) - i.e. RecordLoad and RecordSave functions - then encoded in Base-64, to be stored as plain text within the JSON stream.

But custom record JSON serialization can be defined in the latest modification.

See http://blog.synopse.info/post/2012/05/0 … of-records
and http://synopse.info/fossil/info/5b3468e16c for the code modification.

Even if older versions of Delphi are not able to generate the needed RTTI information for such serialization, the mORMot framework offers a common way of implementing any custom serialization of records.
When records are used as Data Transfer Objects within services (which is a good idea in common SOA implementation patterns), such a custom serialization format can be handy, and makes more natural service consumption with AJAX clients.


Board footer

Powered by FluxBB