IoT Open Tech
Home
  • Platform
  • Modules
  • Devices
Guides
Changelog
  • English
  • Svenska
Home
  • Platform
  • Modules
  • Devices
Guides
Changelog
  • English
  • Svenska
  • Platform

    • IoT Open Lynx Platform
    • Lynx Architecture
    • Main objects
    • DeviceX / FunctionX
    • Metadata
      • Known meta-keys
    • Icons
    • Schedules
    • Edge Apps
      • The app.json file
      • Package edge.lynx
      • Package timer
      • Package json
      • Package mq
      • Package log
      • Package edge
    • Notifications
      • Templating language
      • Executors
    • Events
    • Permissions
    • API Reference and Libraries

Package json

Functions

json:encode()

Encode lua object as JSON.

Parameters

NameOptionalDescription
ValueNoThe 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

NameOptionalDescription
DataNoThe JSON string to be decoded

Example

local jsonData = "{\"value\": 1.0}"
local obj = json:decode(jsonData)
Last updated:
Prev
Package timer
Next
Package mq