json.isNull Synchronous

Distinguish an explicit JSON null from a missing field. That difference matters in patches where null means “clear this value” and an absent key means “leave it alone.”

Syntax
Luau
json.isNull(value: any) -> boolean

Parameters

Function parameters
ParameterTypeDescription
valueanyValue to compare with json.null.

Returns

boolean

true only for the json.null singleton. Luau nil is not json.null.

Usage notes

Default decoding preserves null as json.null. Passing useNull=false can instead discard object fields or leave holes in arrays.

Example

Example
Luau
local update = json.decode('{"nickname":null}')
print(json.isNull(update.nickname)) -- true
print(update.missing == nil) -- true
Kawaii documentation