System.JSON.Builders.TJSONArrayBuilder

From RAD Studio API Documentation
Jump to: navigation, search

System.JSON.Builders.TJSONCollectionBuilderSystem.TObjectTJSONArrayBuilder

Delphi

TJSONArrayBuilder = class(TJSONCollectionBuilder)

C++

class PASCALIMPLEMENTATION TJSONArrayBuilder : public TJSONCollectionBuilder

Properties

Type Visibility Source Unit Parent
class public
System.JSON.Builders.pas
System.JSON.Builders.hpp
System.JSON.Builders System.JSON.Builders

Description

JSON writer wrapper that provides a fluent interface to write a JSON array.

Call BeginArray to start writing your array. Clear deletes the content of the array builder.

Example

The examples below write the following array:

[
  "value 1",
  "value 2"
]

Delphi:

with TJSONArrayBuilder.Create(MyJSONWriter) do
try
  BeginArray
    .Add('value 1')
    .Add('value 2');
finally
  Free;
end;

C++:

TJSONArrayBuilder* MyArrayBuilder = new TJSONArrayBuilder(MyJSONWriter);
try {
  MyArrayBuilder
    ->BeginArray()
      ->Add(String("value 1"))
      ->Add(String("value 2"));
} __finally {
  delete MyArrayBuilder;
}

See Also