JSON

json.type

Returns the JSON-aware type of a value, including array, object, and null markers.

Syntax

json.type(value: any): string

Arguments

NameTypeDescription
valueanyNew value to write.

Returns

NameTypeDescription
jsonTypestringJSON-aware type name.

Description

Returns the JSON-aware type of a value, including array, object, and null markers.

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

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

Example

Report the JSON-aware type of values and marked tables.

print(json.type(json.array()))
print(json.type(json.object()))
print(json.type(json.null))
print(json.type("text"))