【发布时间】:2013-10-08 23:39:37
【问题描述】:
我肯定希望能够添加这个:
Object.prototype.toJson = function() {
this.toJson = undefined;
return JSON.stringify(this);
}
但它得到所有循环引用-y。我仍然希望能够到处写 .toJson()。
【问题讨论】:
-
也许没有 this.toJson = undefined 在那里。那是在我的剪贴板中搞砸了。
-
放弃
this.toJson = undefined;...你想用它做什么? -
-
@nclu:你能告诉我们你尝试过的对象
.toJson()吗?可能它只是有一个循环引用。
标签: javascript json serialization