JsonArrayInsertNull

value JsonArrayInsertNull ( value jsonArray, value Index );

Rückgabewert

Rückgabewert

Beschreibung

TRUE / true / 1

null wurde erfolgreich eingefügt.

FALSE / false / 0

null konnte nicht eingefügt werden.

Parameter

jsonArray

Das gültige JSONARRAY-Objekt, in dem der boolsche Wert von Value eingefügt werden soll.

Index

Die Position im JSONARRAY-Objekt jsonArray an der null eingefügt werden soll. Für das erste JSONARRAY-Element gilt: Index = 0.

Bemerkungen

Fügt an der Position Index null in das JSONARRAY-Objekt's jsonArray ein.

Beispiel

//Inhalt von "data.json":
//{
//  "Boolean": true,
//  "Number": 3.14,
//  "WithoutContent": null,
//  "String": "xyz",
//  "Array": [
//    1,
//    true,
//    null,
//    "abc"
//  ]
//}
value json;
if (!JsonCreateFromFile(json, "data.json"))
    return (false);
end
value jsonArray, insertedArray;
jsonArray = JsonGetArray(json, "Array");
insertedArray = JsonArrayInsertArray(jsonArray, 1);

JsonArrayAddNumber(insertedArray, 2);
JsonArrayAddNumber(insertedArray, 3);

string strJson;
strJson = JsonToString(json);
//Inhalt von strJson:
//{
//  "Boolean": true,
//  "Number": 3.14,
//  "WithoutContent": null,
//  "String": "xyz",
//  "Array": [
//    1,
//    [
//      2,
//      3
//    ],
//    true,
//    null,
//    "abc"
//  ]
//}
JsonArrayInsertBool(jsonArray, 2, false);
JsonArrayInsertNumber(jsonArray, 3, e);
JsonArrayInsertString(jsonArray, 4, "def");
JsonArrayInsertNull(jsonArray, 4);

strJson = JsonToString(json);
//Inhalt von strJson:
//{
//  "Boolean": true,
//  "Number": 3.14,
//  "WithoutContent": null,
//  "String": "xyz",
//  "Array": [
//    1,
//    [
//      2,
//      3
//    ],
//    false,
//    2.718282,
//    null,
//    "def",
//    true,
//    null,
//    "abc"
//  ]
//}JsonClose(json);
 

Die Json-Funktionen

Siehe auch JsonArrayInsertArray, JsonArrayInsertBool, JsonArrayInsertNumber, JsonArrayInsertObject, JsonArrayInsertString