脚本介体setPayloadJSON将数字字符串格式化为Number

时间:2017-09-15 19:33:29

标签: wso2 wso2esb

我们使用脚本调解器为聚合调解器创建有效负载,我们有一个数字字符串,其类型为字符串,但mc.setPayloadJSON始终将字符串格式化为json输出中的数字。

所需:

        {
            "id": "29fcf271-a077-4bd9-abb0-f6e7f8bef801",
            "scheme": "EMAIL",
            "date": "30/10/1986",
            "name": "Name",
            "document": "36105126875",
            "type": "CODE",
            "value": "c*********a@******.com",
            "mat": "553179"
        },

结果:

        {
            "id": "29fcf271-a077-4bd9-abb0-f6e7f8bef801",
            "scheme": "EMAIL",
            "date": "30/10/1986",
            "name": "Name",
            "document": 36105126875,
            "type": "CODE",
            "value": "c*********a@******.com",
            "corporateid": 553179
        },

JS示例:

var payload = { "methods": [{ "reference": id, "type": "CODE", "value": email_mask, "scheme": "EMAIL", "name": "Name", "document": numdoc, "mat": mat, "date": dt_birth }] }

mc.setPayloadJSON(有效载荷);

有一种方法可以使用脚本调解器mc.setPayloadJSON将数字字符串格式化为字符串吗?

谢谢

0 个答案:

没有答案