javascript把JSON对象数组转换成JSON字符串

[复制链接]
查看11 | 回复3 | 2013-3-15 13:14:02 | 显示全部楼层 |阅读模式
add方法改成function add(id,name,age){
humens.push({
id: id,
name: name,
age: age
});}原因是你push进去的是functionfunction是不可序列化的, stringify之后会变成null...
回复

使用道具 举报

千问 | 2013-3-15 13:14:02 | 显示全部楼层
JSON.stringify 是 json2.js的方法,你确认加入的 json2.js了么?...
回复

使用道具 举报

千问 | 2013-3-15 13:14:02 | 显示全部楼层
JSON.stringity(humens )拼写错误, t改成fJSON.stringify(humens )...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行