#1 2018-05-24 21:39:22

automacaosamos
Member
Registered: 2015-02-19
Posts: 20

problems with SynCrossPlatformJSON Lazarus

type
   TNamesVO = class
  private
    fname : String;
  published
    property name : String   read fname write fname;
  end;

type
   TExtjsVO = class
  private
    fsuccess : boolean;
    frows    : TList;
    ftotal   : integer;
  published
    property success    : boolean  read Fsuccess write Fsuccess;
    property rows       : TList    read Frows    write Frows;
    property total      : integer  read Ftotal   write Ftotal;
  end

.
.
.
var
  ExtjsVO : TExtjsVO;
  List    : TList;
  Names   : TNamesVO;
begin
  ExtjsVO := TExtjsVO.Create;
  List   := TList.Create;
  Names      := TNamesVO.Create;
  Names.name := 'Test';
  List.Add(Names);
  try
    ExtjsVO.success        := True;
    ExtjsVO.rows           := List;
    ExtjsVO.total          := 1;
    MemoServer.Lines.Text  :=  ObjectToJson(ExtjsVO);
  finally
    List.Clear;
    FreeAndNil(List);
    FreeAndNil(ExtjsVO);
  end;                     

it returns:

{"success":null,"rows":[{"name":"Test"}],"total":1}

should not it be?

{"success":true,"rows":[{"name":"Test"}],"total":1}

in delphi it does correct.

Last edited by automacaosamos (2018-05-24 21:40:59)

Offline

Board footer

Powered by FluxBB