System.JSON.Writers.TJsonTextWriter.WritePropertyName
Delphi
procedure WritePropertyName(const Name: string); overload; override;
procedure WritePropertyName(const Name: string; Escape: Boolean); overload;
C++
virtual void __fastcall WritePropertyName(const System::UnicodeString Name)/* overload */;
HIDESBASE void __fastcall WritePropertyName(const System::UnicodeString Name, bool Escape)/* overload */;
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 le nom de propriété d'une paire clé-valeur dans un objet JSON.
Paramètres :
- Name: le nom de la propriété.
- Escape: remplace des caractères spéciaux par leurs codes d'échappement.- Truepour les opérations de conversion et- Falsepour les opérations inverses. Les caractères multi-octets sont automatiquement placés dans une séquence d'échappement.
Voir l'extrait de code ci-dessous pour illustrer l'utilisation de WritePropertyName :
  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"
    }
  ]
}