System.JSON.Writers.TJsonTextWriter.WriteComment
Delphi
procedure WriteComment(const Comment: string); override;
C++
virtual void __fastcall WriteComment(const System::UnicodeString Comment);
Propriétés
Type | Visibilité | Source | Unité | Parent |
---|---|---|---|---|
procedure function |
public | System.JSON.Writers.pas System.JSON.Writers.hpp |
System.JSON.Writers | TJsonTextWriter |
Description
Ecrit un commentaire contenant le texte spécifié.
Paramètre :
Comment
: le texte que vous voulez afficher comme commentaire dans les données JSON.
Voir l'extrait de code ci-dessous pour illustrer l'utilisation de WriteComment :
Writer.WriteStartObject;
Writer.WritePropertyName('colors');
Writer.WriteStartArray;
Writer.WriteStartObject;
Writer.WriteComment('Hexadecimal value for the red color');
Writer.WritePropertyName('name');
Writer.WriteValue('red');
Writer.WritePropertyName('hex');
Writer.WriteValue('#f00');
Writer.WriteEndObject;
Writer.WriteEndArray;
{
"colors": [
{
/*Hexadecimal value for the red color*/
"name": "red",
"hex": "#f00"
}
]
}