You are not logged in.
BREAKING CHANGE of TTextWriter/TJSONWriter.WriteObject() method and ObjectToJSON() function: serialization is now defined with TTextWriterWriteObjectOptions set - therefore, TJSONSerializerCustomWriter callback signature changed.
/// available options for TTextWriter.WriteObject() method
// - woHumanReadable will add some line feeds to the content, to make it
// more human eye friendly
// - woDontStoreDefault (which is set by default for WriteObject method) will
// avoid serializing properties including a default value (JSONToObject function
// will set the default values, so it may help saving some bandwidth or storage)
// - woFullExpand will generate a log-friendly layout, including instance class
// name and reference pointer (it is used in TSynLog)
// - woStoreClassName will add a "ClassName":"TMyClass", field
TTextWriterWriteObjectOption = (
woHumanReadable, woDontStoreDefault, woFullExpand, woStoreClassName);
/// options set for TTextWriter.WriteObject() method
TTextWriterWriteObjectOptions = set of TTextWriterWriteObjectOption;
/// serialize as JSON the given object
// - this default implementation will write null, or only write the
// class name and pointer if FullExpand is true - use TJSONSerializer.
// WriteObject method for full RTTI handling
// - default implementation will write TList/TCollection/TStrings/TRawUTF8List
// as appropriate array of class name/pointer (if FullExpand=true) or string
procedure WriteObject(Value: TObject;
Options: TTextWriterWriteObjectOptions=[woDontStoreDefault]); virtual;
See http://synopse.info/fossil/info/0b7919bbdc
and http://blog.synopse.info/post/2012/04/1 … -any-class modified blog article.
By the way, it follows the nice advice of Nick: http://www.nickhodges.com/post/How-Not- … eters.aspx, but using a set of enumerates, which I find very readable and powerful.
Offline