我有以下数据源 - 使用X2JS转换为使用XML的JSON:
{
"blog": {
"article": [
{
"id": "1",
"author": "eat-sleep-code",
"title": {
"__cdata": "Thefirstarticle."
},
"content": {
"__cdata": "\nThisismyfirstarticleinmytestsite.\n"
},
"createdate": "2014-05-09"
},
{
"id": "2",
"author": "eat-sleep-code",
"title": {
"__cdata": "Thesecondarticle."
},
"content": {
"__cdata": "\nThisismysecondarticleinmytestsite.Thisarticle'screatedateisactuallyearlier.\n"
},
"createdate": "2014-05-08"
}
]
}
}
我想找到"文章的数量"。
Object.keys(jsonObject).length;
只是得到了我1.我猜是因为它找到了一个"博客"项目
答案 0 :(得分:0)
jsonObject.blog.article.length