var cache = [];
var str = JSON.stringify(这里是对应的变量, function(key, value) {
if (typeof value === 'object' && value !== null) {
if (cache.indexOf(value) !== -1) {
// Circular reference found, discard key
return;
}
// Store value in our collection
cache.push(value);
}
return value;
});
msg.body = str;
this.ws.send(JSON.stringify(msg));