Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Object-Pascal / Delphi-Language (https://www.delphipraxis.net/32-object-pascal-delphi-language/)
-   -   Delphi Attribute bei ObjectToJsonstring (https://www.delphipraxis.net/197296-attribute-bei-objecttojsonstring.html)

Ghostwalker 27. Jul 2018 15:06

Delphi-Version: 10.2 Tokyo

Attribute bei ObjectToJsonstring
 
Also irgendwie ignoriert mir die Funktion ObjectToJsonString von TJson meine Attribute.

Folgende Klasse:

Delphi-Quellcode:
  TTest = Class
    private
      fCaption : string;
      fIdent  : Integer;
      [JsonName('Nixda')]
      fInternal: String;
    public
      constructor Create;
      Destructor Destroy;override;
    published
  End;
Ergibt
Code:
{"caption":"Testcaption","ident":42,"internal":"Testcaption mit 42"}
Dabei sollte es eigentlich
Code:
{"caption":"Testcaption","ident":42,"Nixda":"Testcaption mit 42"}
sein.

Muss man da noch irgendwas beachten, wenn man so Objekte serialisieren will ?

Ghostwalker 27. Jul 2018 15:17

AW: Attribute bei ObjectToJsonstring
 
:wall::wall::wall::wall::wall::wall:

Rest.Json.Types nicht in der Uses...........

Der schöne Günther 27. Jul 2018 15:30

AW: Attribute bei ObjectToJsonstring
 
Alternativ auf die Compiler-Warnungen schauen :P


Alle Zeitangaben in WEZ +1. Es ist jetzt 11:30 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz