Converting the javascript object to json object
This question already has an answer here:
logMessage = function (msg, severity, vendorId, userName, actionPerformed, priority, traceId, dataSent) {
this.message = msg;
this.severity = severity;
this.vendorId = vendorId;
this.userName = userName;
this.actionPerformed = actionPerformed;
this.priority = priority;
this.traceId = traceId;
this.dataSent = dataSent;
};
var msg = new logMessage(err, "High", "none", qry.username, "Error on login call: /req/login", "high", "", qry);
Utility.writeToLoggly(JSON.stringify(msg));
你可以使用JSON.stringify()函数,所以只需添加到你的代码中:
Utility.writeToLoggly(JSON.stringify(msg));
链接地址: http://www.djcxy.com/p/8090.html
上一篇: 如何访问JSON对象中的值?