Javascript 键值递增的嵌套JSON
我试图读取一条嵌套的JSON消息,其中的键值是递增的整数值,但它似乎不起作用Javascript 键值递增的嵌套JSON,javascript,jquery,json,Javascript,Jquery,Json,我试图读取一条嵌套的JSON消息,其中的键值是递增的整数值,但它似乎不起作用 $.each(data.post, function(entryIndex, entry) { $.each(this.entryIndex, function() { alert(this.username); }); }); 很抱歉,我试图将JSON代码粘贴到这里,但一直出现格式错误。相反,我上传了JSON 你的关卡太深了: $.each(data.posts, funct
$.each(data.post, function(entryIndex, entry) {
$.each(this.entryIndex, function() {
alert(this.username);
});
});
很抱歉,我试图将JSON代码粘贴到这里,但一直出现格式错误。相反,我上传了JSON 你的关卡太深了:
$.each(data.posts, function() {
alert(this.username);
});
请看这里:
这将为您获取回复的用户名:
$.each(data.posts, function() {
$.each(this.replies, function(){
alert(this.username);
});
});
我们可以看到您正在使用的JSON吗?你确定JSON字符串已经被解析成一个对象吗?你能提供JSON对象结构吗?也许它会包含一些示例数据?
$.each(data.posts, function() {
$.each(this.replies, function(){
alert(this.username);
});
});