复杂一些的序列化
var test = {
x:1,
y:2,
z:{
z1:2,
z2:3,
toJSON:function(){
return this.z1 + this.z2;
}
}
};
console.log(JSON.stringify(test));在定义复杂一些的序列化时,报语法错误,就是按照老师给的格式写的,请看看是哪里的问题?
var test = {
x:1,
y:2,
z:{
z1:2,
z2:3,
toJSON:function(){
return this.z1 + this.z2;
}
}
};
console.log(JSON.stringify(test));在定义复杂一些的序列化时,报语法错误,就是按照老师给的格式写的,请看看是哪里的问题?
2016-04-19
举报