JSON

json.isObject

Returns whether a value is treated as a JSON object by Real's JSON table detection.

Syntax

json.isObject(value: any): boolean

Arguments

NameTypeDescription
valueanyValue to inspect. Non-table values return false.

Returns

NameTypeDescription
isObjectbooleantrue when the value is a table marked as a JSON object or when Real's JSON table detection does not classify the table as an array. Empty unmarked tables return true.

Description

Returns whether a value is treated as a JSON object by Real's JSON table detection.

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 treated as a JSON object by Real's JSON encoder.

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

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