JSON

json.isNull

Returns whether a value is the JSON null sentinel.

Syntax

json.isNull(value: any): boolean

Arguments

NameTypeDescription
valueanyNew value to write.

Returns

NameTypeDescription
isNullbooleanTrue when the value is the JSON null sentinel.

Description

Returns whether a value is the JSON null sentinel.

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 for the JSON null sentinel without treating it as nil.

local value = json.decode("null")

if json.isNull(value) then
    print("The value is JSON null")
end