#1 2014-09-19 01:49:44

jsmart
Member
Registered: 2014-09-19
Posts: 8

Serialize non-published items without custom reader/writer

Hi

Just started looking into this framework.

For now, I am trying to serialize an object (ie descendant of TObject) into JSON (and back again).

It seems that the default (basic) methods - eg ObjectToJSON - only work against Published items.  Is that true?  Do I really need to make all my properties published to have them automatically serialized by the default parser?  Or if I don't want to do that, do I have to create my own custom Reader/Writer methods to do the serialization for me?  Seems a lot of work with the advanced RTTI nowadays.

Thanks!

Offline

#2 2014-09-19 06:23:10

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,182
Website

Re: Serialize non-published items without custom reader/writer

Only published fields are serialized, by design.

If you want an object which would be a value object, consider using a record instead.

Offline

Board footer

Powered by FluxBB