JSON

json.isObject

Returns whether a value is marked or shaped as a JSON object.

Syntax

json.isObject(value: any): boolean

Arguments

NameTypeDescription
valueanyNew value to write.

Returns

NameTypeDescription
isObjectbooleanTrue when the value is treated as a JSON object.

Description

Returns whether a value is marked or shaped as a JSON object.

Call it with 1 parameter(s): value. The argument table explains which values are required and which ones only refine the behavior.

It returns isObject (boolean). Use the returns table to separate successful values from nil results and recoverable errors.

Example

Check whether a table is represented as a JSON object.

local record = json.object({ name = "Real" })
local items = json.array({ "one", "two" })

print(json.isObject(record))
print(json.isObject(items))