See here . Bellow is great news:
procedure TForm13.Button4Click(Sender: TObject); var LContact: TContact; oMarshaller: TJSONMarshall; crtVal: TJSONValue; begin LContact:=TContact.Create; //our custom class LContact.Name:='wings-of-wind.com'; LContact.Age:=20; //fill with some data oMarshaller:=TJSONMarshal.Create(TJSONConverter.Create); //our engine try crtVal:=oMarshaller.Marshal(LContact); //serialize to JSON Memo1.Text:=crtVal.ToString; //display finally //cleanup FreeAndNil(LContact); FreeAndNil(oMarshaller); end; end;
You can also see here a more complex example of Adrian Andrei (DataSnap architect), as well as an example of custom marshaling here .
source share