JsonIsNull

value JsonIsNull ( value jsonArray, value Index / string strPath);

Rückgabewert

Rückgabewert

Beschreibung

TRUE / true / 1

An der Position Index befindet sich ein leeres Element (null).
Der Pfad strPath verweist auf ein leeres Element (null).

FALSE / false / 0

Das Element an der Position Index ist kein null Wert.

-1

Das Auslesen des JSON-Elements ist fehlgeschlagen.
Die Position Index liegt außerhalb des gültigen JSON-Bereichs von json.
Es wurde kein Element mit dem Pfad strPath gefunden.

Parameter

json

Das JSON-Objekt, in dem der Wert eines Elements auf null geprüft werden soll.

Index

Die Position des Elements im JSON-Objekt json, das auf null geprüft werden soll. Für das erste JSON-Element gilt: Index = 0.

strPath

Der Pfad des Elements im JSON-Objekt json, das auf null geprüft werden soll.

Bemerkungen

Prüft, ob das Element an der Position Index im JSONARRAY-Objekt jsonArray einen null Wert besitzt, bzw. ob das über den Pfad strPath im JSON-Objekt json erreichbare JSON-Element einen null Wert besitzt. Der Schlüsselwert null zeigt an, dass dem Element kein Wert zugewiesen wurde, also auch nicht 0 bzw. ein Leerstring "" ist.

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 isNull;

isNull = JsonIsNull(json, "Boolean");
//isNull = false
isNull = JsonIsNull(json, "WithoutContent");
//isNull = true
isNull = JsonIsNull(json, "Array[1]");
//isNull = false
isNull = JsonIsNull(json, "Array[2]");
//isNull = true
JsonClose(json);
 

Die Json-Funktionen

Siehe auch JsonHasMember