Summary

Prop method should be used to read property name when de-serializing object properties.

Syntax

function Prop: string; overload;

Return Value

Type: string

Prop method returns de-serializing property name.

Remarks

Prop method calls are only possible while de-serializing object data manually; that is - after NG.Serialization.TDeserializer.BeginObject(string) and before corresponding NG.Serialization.TDeserializer.EndObject method calls. The process of a property de-serialization should include two method calls: first, Prop method should be called read property name, and then, one of the methods which reads property value, should be called. The following methods can be called after Prop method to read property value:

Examples

DelphiCopyCode imageCopy Code
D.BeginObject(objtp);

if objtp <> 'Book' then
  raise Exception.Create('Unexpected object type');
book := TBook.Create;

while D.HasNext do
begin
  if D.Prop = 'Tittle' then
    book.Tittle := D.Value<string>
  else if D.Prop = 'Author' then
    book.Author := D.Value<string>
  else
    raise Exception.Create('Unexpected property name');
end;

D.EndObject;