jquery - parsing Parsing JSON array within array
I have the following code that gets the first 'name' in an array called 'feeds' within my JSON, I would like to now loop through the JSON and get each name. I haven't been able to get that loop to work.
JSON:
{"title":"Testing","created_at":"2011年10月05日T16:23:26.217Z","feeds":[{"0":{"name":"twitter","key":"person1"},"1":{"name":"twitter","key":"person2"},"_id":"4e8c847e02edc10035000003"}]}
This gets the first title successfully:
$.getJSON(getthisshit, function(myJson) {
var myfeed = myJson.feeds[0][0].name;
alert(myfeed);
});
I tried to loop through doing something like this, but have not been able to get it to work:
$.getJSON(getthisshit, function(myJson){
$.each(myJson.feeds, function(i,item){
alert(item.name);
});
});
jquery - parsing JSON array within array
I have the following code that gets the first 'name' in an array called 'feeds' within my JSON, I would like to now loop through the JSON and get each name. I haven't been able to get that loop to work.
JSON:
{"title":"Testing","created_at":"2011年10月05日T16:23:26.217Z","feeds":[{"0":{"name":"twitter","key":"person1"},"1":{"name":"twitter","key":"person2"},"_id":"4e8c847e02edc10035000003"}]}
This gets the first title successfully:
$.getJSON(getthisshit, function(myJson) {
var myfeed = myJson.feeds[0][0].name;
alert(myfeed);
});
I tried to loop through doing something like this, but have not been able to get it to work:
$.getJSON(getthisshit, function(myJson){
$.each(myJson.feeds, function(i,item){
alert(item.name);
});
});
Parsing JSON array within array
I have the following code that gets the first 'name' in an array called 'feeds' within my JSON, I would like to now loop through the JSON and get each name. I haven't been able to get that loop to work.
JSON:
{"title":"Testing","created_at":"2011年10月05日T16:23:26.217Z","feeds":[{"0":{"name":"twitter","key":"person1"},"1":{"name":"twitter","key":"person2"},"_id":"4e8c847e02edc10035000003"}]}
This gets the first title successfully:
$.getJSON(getthisshit, function(myJson) {
var myfeed = myJson.feeds[0][0].name;
alert(myfeed);
});
I tried to loop through doing something like this, but have not been able to get it to work:
$.getJSON(getthisshit, function(myJson){
$.each(myJson.feeds, function(i,item){
alert(item.name);
});
});
jquery - parsing JSON array within array
I have the following code that gets the first 'name' in an array called 'feeds' within my JSON, I would like to now loop through the JSON and get each name. I haven't been able to get that loop to work.
JSON:
{"title":"Testing","created_at":"2011年10月05日T16:23:26.217Z","feeds":[{"0":{"name":"twitter","key":"person1"},"1":{"name":"twitter","key":"person2"},"_id":"4e8c847e02edc10035000003"}]}
This gets the first title successfully:
$.getJSON(getthisshit, function(myJson) {
var myfeed = myJson.feeds[0][0].name;
alert(myfeed);
});
I tried to loop through doing something like this, but have not been able to get it to work:
$.getJSON(getthisshit, function(myJson){
$.each(myJson.feeds, function(i,item){
alert(item.name);
});
});