调试数据处理脚本
本地
本地
POST
http://127.0.0.1:9999
数据处理脚本
前端给出如下提示
function encodeInp(msg,topic)
// 入参: msg 为输入的消息(订阅或者上报的消息),topic 为消息的主题 均为string类型
// 出参: 返回值为string类型,为编码后的消息
// 该函数为编码函数,将输入的消息编码为平台可识别的消息格式或者设备可识别的消息格式
// 请根据实际需求编写编码逻辑
// string与jsonObj互转需导入json库:local json = require("json")
//例,string转jsonObj:local jsonTable = json.decode(msgString)
//例,jsonObj转string:local json_str = json.encode(jsonTable)
// 以下为示例代码
// 只支持如下json包导入
//处理完后将对象转回字符串形式
local json = require("json")
local jsonTable = json.decode(jsonString)
if jsonTable.services[1].service_id == "CO2" then
jsonTable.services[1].properties.current = 200
end
local newJsonString = json.encode(jsonTable)
return newJsonString
end
请求参数
Header 参数
x-token
string
可选
默认值:
{{x-token}}
Body 参数application/json
示例代码
返回响应
修改于 2024-12-18 06:00:40