System.JSON.Writers.TJsonTextWriter.WritePropertyName

提供: RAD Studio API Documentation
移動先: 案内検索

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 */;

プロパティ

種類 可視性 ソース ユニット
procedure
function
public
System.JSON.Writers.pas
System.JSON.Writers.hpp
System.JSON.Writers TJsonTextWriter


説明

JSON オブジェクトにおいてプロパティを表す名前/値ペアの名前を書き込みます。

パラメータ:

  • Name: プロパティの名前です。
  • Escape: 一部の特殊文字をエスケープ コードに置き換えます。True を指定すると置き換えが行われ、False を指定すると行われません。マルチバイト文字は自動的にエスケープされます。

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"
    }
  ]
}

関連項目