System.JSON.Writers.TJsonTextWriter.WriteNull

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

procedure WriteNull; override;

C++

virtual void __fastcall WriteNull();

Properties

Type Visibility Source Unit Parent
procedure
function
public
System.JSON.Writers.pas
System.JSON.Writers.hpp
System.JSON.Writers TJsonTextWriter

Description

Writes a null value.

See the code snippet below to illustrate the use of WriteNull:

  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.WriteNull;
  //Writer.WriteValue('#f00');
  Writer.WriteEndObject;
  Writer.WriteEndArray;
{
  "colors": [
    {
      /*Hexadecimal value for the red color*/
      "name": "red",
      "hex": null
    }
  ]
}

See Also