[Lazarus] Convert record to JSON?

Bo Berglund bo.berglund at gmail.com
Sun Jul 22 07:50:06 CEST 2018


On Sun, 22 Jul 2018 00:22:58 +0200, Bo Berglund via Lazarus
<lazarus at lists.lazarus-ide.org> wrote:

>Can the JSON handlers deal with the array type TIpAddress?

Well, it trurns out that this fails earlier on when compiling...
So I have:

type
  TIpAddress = array[0..3] of byte;

  {$M+}
  TEspConfiguration = Class(TObject)
  private
    Fchecksum: word;
    Fssid: AnsiString;
    ...
    Faddr: TIpAddress;  //<==
    ...
  published
    property checksum: word read Fchecksum write Fchecksum;
    property ssid: AnsiString read Fssid write Fssid ;
    ...
    property addr: TIpAddress read Faddr write Faddr; // <==
    ...
  end

When compiling I get the following error on the "property addr" line:

wificommhandler.pas(97,33) Error: This kind of property cannot be
published

If I replace the type declaration TIpAddress with array[0..3] of byte
it just adds another error message...

Can published properties only be simple variable types not including
arrays?
Seems odd since an AnsiString, which is accepted, is just an array of
AnsiChar.


-- 
Bo Berglund
Developer in Sweden



More information about the Lazarus mailing list