Skip to content

json_encode

json_encode(table) converts a Lua table or value into a JSON string. Uses SpyWeb’s built-in high-performance JSON engine, handling nested tables, arrays, booleans, and nulls automatically.

json_encode(table)
sync
Param Type Description
table any The Lua value to encode
Value Type Description
json string JSON-encoded string
local payload = {
url = "https://example.com",
options = { waitUntil = "networkidle2" }
}
local body = json_encode(payload)
local resp = http_post("https://api.rendering-service.com/render", body, {["Content-Type"]="application/json"})