Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
So let me save this and I'll switch back to a browser, refresh our page, And if you have the console openm remember that you could just right-click on this page and select Inspect Element if you are using Google Chrome like me. And I can see the series of objects that this returns. If I open that up, I can see each individual object and inside each object, I can see different name and value pairs. So this is a little different from what we would see with XML. It's essentially an array of objects and each object has a label and the data from our file.
So here's the bad news: JSON parse is not available in some older browsers. So, if you go to this website, you could see that it's available in most modern browsers, but a lot of the older versions of IE do not support the parse command. So your options are to use EVAL--but that has some security issues--write your own parser, or use an existing library. jQuery for example, takes care of this very well. Let's go back to our code. So we'll modify our code so that it outputs a list of speakers. We'll start by creating the output variable, just like we did with XML, and then in here we'll loop through the valleys of the objects.
To do that I am going to use the for in statement. Finally, we'll target the update element with the results of our output variable. So let's save this and switch back to our browser, refresh the page, and you can see that the list appears. So working with JSON files is pretty easy with the parse command. However, it might not be available in all browser versions. So for ultimate compatibility, I recommend that you use a library like jQuery.
Get unlimited access to all courses for just $25/month.Become a member
82 Video lessons · 97233 Viewers
61 Video lessons · 84513 Viewers
71 Video lessons · 68718 Viewers
56 Video lessons · 101203 Viewers
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.
Your file was successfully uploaded.