CAUTION: SLIPPERY FLOORThe Arduino Library Manager installs the ArduinoJson version 6 by default.
However, using version 5 is highly recommended because version 6 is still in beta stage.
Open the Arduino Library Manager and make sure that ArduinoJson version 5 is installed.
Tells whether the variant contains a value.
bool success() const;
trueif the variant contains a value,
falseif the variant is empty or invalid.
null is a value in JSON, so this function returns
true if the variant contains
null as an illegal value. So, you can use it to protect against null values.
JsonVariant variant; bool beforeAssign = variant.success(); // false variant = 42; bool afterAssign = variant.success(); // true