System.JSON.Builders.TJSONCollectionBuilder.TElements.AddElements
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 */;
Propriétés
Type | Visibilité | Source | Unité | Parent |
---|---|---|---|---|
function | public | System.JSON.Builders.pas System.JSON.Builders.hpp |
System.JSON.Builders | TElements |
Description
Ajoute les valeurs spécifiées au tableau JSON, et renvoie cette instance de TElements pour le chaînage de méthode (EN).
Vous pouvez spécifier les valeurs sous la forme d'un constructeur JSON, d'une chaîne JSON ou d'un tableau de constantes.
Si vous utilisez un tableau de constantes, vous pouvez utiliser les chaînes "{", "}", "[" et "]" comme éléments dans le tableau pour indiquer le début et la fin des tableaux et des objets. Par exemple :
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("}")])));
Les exemples ci-dessus remplissent le tableau JSON avec les valeurs suivantes :
"value 1",
[
"array",
"value",
"2"
],
{
"key 3.1": "value 3.1"
}
Voir aussi
- System.JSON.Builders.TJSONCollectionBuilder.TElements.Add
- System.JSON.Builders.TJSONCollectionBuilder.TElements.AddMaxKey
- System.JSON.Builders.TJSONCollectionBuilder.TElements.AddMinKey
- System.JSON.Builders.TJSONCollectionBuilder.TElements.AddNull
- System.JSON.Builders.TJSONCollectionBuilder.TElements.AddUndefined
- System.JSON.Builders.TJSONCollectionBuilder.TElements.BeginArray
- System.JSON.Builders.TJSONCollectionBuilder.TElements.BeginObject