Appearance
ToJSON 
将实体变量序列化为JSON字符串。
业务属性 
| 属性 | 含义 | 说明 | 输入限定 | 示例值 | 
|---|---|---|---|---|
| enable | 是否启用该控件,未启用时不编译 | 是否编译 | 选择值 | 启用 | 
| name | 控件返回值命名 | 控件输出值变量名 | 常量 | json | 
| text | 与控件关联的文本 | 设计页控件显示 | 常量 | toJson | 
| param | 实体变量 | 流程变量 | #{object} | 
使用示例 
使用LuaScript控件定义一个实体:
lua
local object = { text = "this is a text" }local object = { text = "this is a text" }
ToJSON控件返回值命名为json,参数输入#{object}

添加输出控件输出返回值json

使用curl请求接口:
$ curl http://localhost:6636/api/toJSON$ curl http://localhost:6636/api/toJSON接口返回:
json
{
    "json": "{\"text\":\"this is a text\"}"
}{
    "json": "{\"text\":\"this is a text\"}"
}