Skip to content

NeonIgnore

Paolo Rossi edited this page Feb 7, 2024 · 4 revisions

NeonIgnore

The  NeonIgnore attribute is used to mark a field (property) that should be ignored by Neon when serializing or deserializing a Delphi structure to or from JSON.

TPerson = class
  private
    // .....
  public
    property FirstName: string read FFirstName write FFirstName;
    property LastName: string read FLastName write FLastName;
    [NeonIgnore] property FullName: string read GetFullName;
    property Age: Integer read FAge write FAge;
    property Country: string read FCountry write FCountry;
    property City: string read FCity write FCity;
  end;

Using NeonIgnore the property FullName will not be in the resulting JSON

{
  "FirstName": "Paolo",
  "LastName": "Rossi",
  "Age": 50,
  "Country": "Italy",
  "City": "Piacenza"
}
Clone this wiki locally