WEBVTT 00:00:02.468 --> 00:00:05.438 Okay I'd like to do a little dance at the beginning of this video. 00:00:05.438 --> 00:00:09.685 um in this video, I am planning to talk about JSON exclusively. 00:00:09.781 --> 00:00:11.834 What is this data format JSON? 00:00:11.854 --> 00:00:14.175 How is it- What does it look like? What does it mean? 00:00:14.175 --> 00:00:17.177 And if you happen to have data in a JSON format 00:00:17.177 --> 00:00:19.836 How do you use that data in a program that you're writing? 00:00:19.836 --> 00:00:23.441 something that runs in a web browser and javascript using p5.js library. 00:00:23.441 --> 00:00:27.126 Okay- so I have some information that I talked about in the previous video. 00:00:27.126 --> 00:00:29.446 If you watched that previous video by the way, thank you. 00:00:29.446 --> 00:00:31.200 That was kind of you. 00:00:31.305 --> 00:00:34.715 Um so let's say, the scenario that I'm posing here, 00:00:35.016 --> 00:00:37.074 You're interested in flowers. 00:00:37.263 --> 00:00:41.528 And you looked all over the internet, you couldn't find any information about flowers. 00:00:41.714 --> 00:00:44.176 But you have this book all about flowers! 00:00:44.466 --> 00:00:47.377 Here's something you could actually do- novel concept 00:00:47.444 --> 00:00:51.857 You could just type the data yourself into a file to use in your program. 00:00:51.954 --> 00:00:54.244 So let's first think about how that might work. 00:00:54.345 --> 00:00:57.065 So actually even before I start doing anything over here 00:00:57.224 --> 00:00:59.238 let's do that just even in our code. 00:00:59.465 --> 00:01:03.955 Right so you know- you - you know how to program, or at least I do 00:01:04.046 --> 00:01:06.504 I think you do if you were watching the videos hopefully. 00:01:06.633 --> 00:01:08.483 Because I don't know if I was doing a good job or not. 00:01:08.652 --> 00:01:15.865 But you might say to yourself like "ah I am going to make this object called flowers" 00:01:15.993 --> 00:01:23.176 And it's going to have a name. I'm just going to say it's a flower. 00:01:23.276 --> 00:01:25.995 It's going to have a name, like sunflower. 00:01:26.154 --> 00:01:29.776 And it's going to have color, which is 00:01:29.995 --> 00:01:34.265 I was going to do color but then I realised there's a problem. 00:01:34.405 --> 00:01:36.865 I should just admit that there's a problem here, so what I started doing by the way 00:01:36.865 --> 00:01:40.085 was that I want to use the p5.js color function which is so nice 00:01:40.184 --> 00:01:43.436 that I can make a nice yellow color- which yellow is red and green I think. 00:01:43.530 --> 00:01:45.656 But that's not going to work up here. 00:01:45.715 --> 00:01:50.645 The color function is only available once I'm actually in setup, once the page has loaded. 00:01:50.745 --> 00:01:53.505 So I'm going to make that global variable, 00:01:53.634 --> 00:01:55.814 and I'm going to make my object here, sorry. 00:01:55.884 --> 00:02:02.064 So name- sunflower, color is- uh let's not name it color because that's a keyword. 00:02:02.134 --> 00:02:05.325 Let's name it C-O-L is color. 00:02:05.362 --> 00:02:07.235 How do you make yellow?