Syntax
json.isNull(value: any): booleanArguments
| Name | Type | Description |
|---|---|---|
value | any | Value to inspect. Only the json.null value returns true; Lua nil and other values return false. |
Returns
| Name | Type | Description |
|---|---|---|
isNull | boolean | true when the value is the exact json.null sentinel, otherwise false. |
Description
Returns whether a value is Real's JSON null sentinel, json.null.
Call it with 1 parameter(s): value. The argument table explains which values are required and which ones only refine the behavior.
It returns isNull (boolean). Use the returns table to separate successful values from nil results and recoverable errors.
Example
Check whether a value is the json.null sentinel instead of Lua nil.
local value = json.decode("null")
if json.isNull(value) then
print("The value is JSON null")
end
print(json.isNull(nil))