First off let me say I am new to js …

I’ve been working on this for 2 days and more than likely making it way harder then it has to be :slight_smile:
Here is what I have so far…

var result = JSON.parse(JSON.stringify(result.feed.entry)); 
                        for(var i = 0; i < result.length; i++){ 
                        var results = new Array(); 
                        var obj = {};  
			            var tube = result[i]; 
                         obj["tLink"] = tube.link[0].$.href; 
						 obj["title"] = tube.title[0]; 
						 obj["id"] = tube['yt:videoId'][0]; 
						 obj["pic"] = tube['media:group'][0]['media:thumbnail'][0].$.url; 

On the left is what I have, the right side is what I’m trying to get to…

Not really sure after a couple days of trying multiple things what I should be doing…
Any help would be very much appreciated!!

Thank you,

Hi johnw8017 welcome to the forum

What happens if you move the “new Array” line to before the “for” loop?

That would be a great idea :smile:

Here is what I got working …

					var	entries = JSON.parse(JSON.stringify(result.feed.entry)),
						results = [];
					for (var i = 0, entry; entry = entries[i]; i++) results.push({
						'tLink' : entry.link[0].$.href,
						'title' : entry.title[0],
						'id' : entry['yt:videoId'][0],
						'pic' : entry['media:group'][0]['media:thumbnail'][0].$.url

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.