# Package json
# Functions
# json:encode()
Encode lua object as JSON.
# Parameters
Name | Optional | Description |
---|---|---|
Value | No | The lua object to be encoded |
# Example
local obj = {
value = 1.0,
timestamp = 123456789,
msg = "This is a message"
}
local jsonData = json:encode(obj)
# json:decode()
Decode JSON text string into a lua object.
# Parameters
Name | Optional | Description |
---|---|---|
Data | No | The JSON string to be decoded |
# Example
local jsonData = "{\"value\": 1.0}"
local obj = json:decode(jsonData)