System.JSON.Builders.TJSONCollectionBuilder.TElements.AddElements

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

function AddElements(const AElements: array of const): TElements; overload;
function AddElements(const ABuilder: TJSONCollectionBuilder): TElements; overload; inline;
function AddElements(const AJSON: string): TElements; overload; inline;

C++

HIDESBASE TJSONCollectionBuilder::TElements* __fastcall AddElements(const System::TVarRec *AElements, const int AElements_High)/* overload */;
HIDESBASE TJSONCollectionBuilder::TElements* __fastcall AddElements(TJSONCollectionBuilder* const ABuilder)/* overload */;
HIDESBASE TJSONCollectionBuilder::TElements* __fastcall AddElements(const System::UnicodeString AJSON)/* overload */;

Properties

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

Description

Adds the specified values to the JSON array, and returns this instance of TElements for method chaining.

You may specify the values as a JSON builder, a JSON string or an array of constants.

If you use an array of constants, you may use the strings "{", "}", "[" and "]" as items in the array to indicate the beginning and the end of arrays and objects. For example:

Delphi:

MyElements.AddElements(['value 1',
                        '[',
                          'array',
                          'value',
                          '2'
                        ']',
                        '{',
                          'key 3.1',
                          'value 3.1',
                        '}']);

C++:

MyElements->AddElements(ARRAYOFCONST(String("value 1"),
                                     String("["),
                                       String("array"),
                                       String("value"),
                                       String("2"),
                                     String("]"),
                                     String("{"),
                                       String("key 3.1"),
                                       String("value 3.1"),
                                     String("}")])));

The examples above fill the JSON array with the following values:

"value 1",
[
  "array",
  "value",
  "2"
],
{
  "key 3.1": "value 3.1"
}

See Also