我有json对象(这个json对象从数据库返回):
{created_at:'Wed Nov 21 19:28:24 +0000 2012', id:271334264140869630, id_str:'271334264140869633', } {created_at:'Wed Nov 21 19:28:24 +0000 2012', id:271334264140869630, id_str:'271334264140869633', }
当我使用JSON.stringify(obj) - >
时{“created_at”:“Wed Nov 21 19:28:24 +0000 2012”, “id”:“271334264140869630”, “id_str”:“271334264140869633” } {“created_at”:“Wed Wed 21 19:28:24 +0000 2012”, “id”:“271334264140869630”, “id_str”:“271334264140869633” }
这个obj在http://jsonlint.com/上无效,因为错误:期待'EOF','}',',',']'
请帮我解决这个错误。
答案 0 :(得分:1)
以下是您的有效JSON。
[
{
"created_at": "WedNov2119: 28: 24+00002012",
"id": 271334264140869630,
"id_str": "271334264140869633"
},
{
"created_at": "WedNov2119: 28: 24+00002012",
"id": 271334264140869630,
"id_str": "271334264140869633"
}
]
这是测试stringify操作的jsfiddle