我想循环一个对象,它从后端接收。在我收到这些消息后,我正在迭代一次容器,我在这里收到错误消息而不是获取对象值。我不能迭代解析后的json
JSON链接样本:https://dl.dropboxusercontent.com/u/10268257/TCSPage.json
这里是我的功能:
jsonConvertor = function (argument) {
return {
init : function (json) {
var that = this;
this.receivedJson = $.parseJSON(json); //i am parseing still not working
console.log(this.receivedJson.DocPageDetails)
// _.each(that.receivedJson.DocPageDetails, function (i, item) {
// console.log(i, item);
// });
}
}
};
$.get("https://dl.dropboxusercontent.com/u/10268257/TCSPage.json")
.error(function() {
console.log('no page found error');
})
.done(function(json){
var html = jsonConvertor().init(json);
})
我不太确定,但我认为JSON表示法不允许评论。检查并告诉我是否有效。而且,检查你的JSON结构,是否使用''this.d.receivedJson.DocPageDetails''(包括''d'')? –