Module rsjson

Require: require("rsjson")

Index

Function

decode()

Deserialize a JSON string into a Lua object

encode()

Serialize a Lua object into a JSON string

Class

array_metatable

A metatable attachable to a Lua table to systematically encode it as Array (instead of Map). As a result, encoded Array will contain only sequence part of the table, with the same length as the # operator on that table.

null

Represents the JSON null value. This can be used in the place of nil to represent empty values.

Alias

DecodeConfig

EncodeConfig

Api reference

alias rsjson.EncodeConfig = rs_mod_lua_core.EncodeConfig
alias rsjson.DecodeConfig = rs_mod_lua_core.DecodeConfig
class rsjson.null: lightuserdata

Represents the JSON null value. This can be used in the place of nil to represent empty values.

class rsjson.array_metatable: table

A metatable attachable to a Lua table to systematically encode it as Array (instead of Map). As a result, encoded Array will contain only sequence part of the table, with the same length as the # operator on that table.

rsjson.encode(obj: any, config?: rsjson.EncodeConfig): string

Serialize a Lua object into a JSON string

Parameters:

obj (any) – Any Lua object

Returns:

_1 (string) – The serialized Lua object

rsjson.decode(str: string, config?: rsjson.DecodeConfig): any

Deserialize a JSON string into a Lua object

Parameters:

str (string) – The JSON string

Returns:

_1 (any) – The deserialized JSON object