JSON

Functions

encode

Encodes a table into an instance of json.

---@param data table
function json.encode(data): json

decode

Decodes an instance of json into a table.

---@param json json
function json.decode(json): table

Types

dump

---@param indent? integer
function json:dump(indent?): string

Example

local data = {a=1, name='test'}
local json = json.encode(data)
print(json:dump()) -- '{ "a": 1, "name": "test" }'