WEBVTT

00:00.080 --> 00:02.120
Well, we have a huge day ahead.

00:02.160 --> 00:03.720
Welcome to week one.

00:03.760 --> 00:04.640
Day four.

00:04.680 --> 00:05.640
This is the day.

00:05.640 --> 00:08.800
It's the second yellow day of digging into integrations.

00:08.800 --> 00:11.560
But in addition we're also going to talk about data.

00:11.560 --> 00:15.200
And we're going to look at expressions at least at a high level.

00:15.200 --> 00:16.120
Let's get into it.

00:16.120 --> 00:22.400
So largely in NHSN, data is something which is described using this format called JSON.

00:22.560 --> 00:28.000
And I imagine that at least half of you, you may fall into the half that are very familiar with JSON.

00:28.040 --> 00:30.160
You've possibly some of you have just seen it before a lot.

00:30.240 --> 00:34.880
Some of you actually probably JavaScript people that know it back to front, and some of you may be

00:34.880 --> 00:35.280
new to it.

00:35.280 --> 00:38.640
You've probably seen it, but you may not know that much about it.

00:38.640 --> 00:40.320
I'm going to cover it briefly.

00:40.320 --> 00:43.480
The main message is you will get very familiar with this.

00:43.480 --> 00:45.000
You're going to see it a lot.

00:45.200 --> 00:52.400
JSON is this very simple, standard way to describe structured data in a way that happens to also be

00:52.440 --> 00:55.080
sort of human readable, which is very convenient.

00:55.080 --> 00:59.400
So machines understand it, humans understand it, and we can work together with it.

00:59.560 --> 01:03.560
Let's cover the four basic ingredients of JSON.

01:03.600 --> 01:06.150
And if you know all this already, just put me on two x axes.

01:06.150 --> 01:07.110
Zoom through this.

01:07.110 --> 01:10.590
So first up, Jason is a way of describing data.

01:10.630 --> 01:16.670
Fundamentally, it expresses things as key value pairs, which means that everything has a name and

01:16.670 --> 01:17.310
a value.

01:17.750 --> 01:23.670
The pair could be a person might have a first name and a value, a last name and a value, an age and

01:23.670 --> 01:24.190
a value.

01:24.430 --> 01:30.510
These are examples of key value pairs, and that forms the heart of Jason and these values.

01:30.550 --> 01:33.790
They can be bunches of text which are called strings.

01:33.950 --> 01:35.150
They can be numbers.

01:35.430 --> 01:37.910
They can be booleans which means like true or false.

01:38.110 --> 01:39.910
And it can be a few other things as well.

01:40.350 --> 01:45.110
So the second key ingredient of Jason is called an object.

01:45.110 --> 01:48.550
An object is basically a bunch of key value pairs.

01:48.710 --> 01:49.710
It's a ton of them.

01:49.750 --> 01:54.190
There could be a person object, which means there might be a first name, last name, age, and other

01:54.190 --> 01:54.710
things.

01:54.990 --> 01:59.230
There's another name they're sometimes called dictionaries and dictionary will be familiar to people

01:59.230 --> 02:02.310
from a Python background because it's like a Python dictionary.

02:02.510 --> 02:08.390
Uh, so that is known as an object, a bunch of key value pairs, or maybe a bit more, as we will see.

02:08.430 --> 02:14.500
And the next ingredient is called an array, Ray, which just means an ordered list of things.

02:14.900 --> 02:17.100
And then the final one nesting.

02:17.100 --> 02:24.420
This is to say that a JSON object we've already said it can contain strings and numbers and booleans.

02:24.660 --> 02:32.780
It could also contain other JSON objects, and those JSON objects could also contain objects and lists

02:32.780 --> 02:33.780
of objects.

02:33.780 --> 02:40.060
So you could have some JSON object that is composed of lots of other objects, which themselves are

02:40.060 --> 02:41.580
composed of more objects.

02:41.580 --> 02:45.340
And a lot of this will come together when we see some concrete examples.

02:45.340 --> 02:49.740
And just to say a couple of words about each of those, and even for those that for which this is this

02:49.740 --> 02:52.660
is old hat, I hope to say a few more interesting things.

02:52.660 --> 02:54.220
So key value pairs.

02:54.420 --> 02:57.220
All data is represented this way in JSON.

02:57.340 --> 02:59.580
It's like name and then a colon.

02:59.580 --> 03:00.620
And then Alice.

03:00.740 --> 03:03.180
It's a key colon a value.

03:03.420 --> 03:09.820
Or it could be age colon 30 or it could be colon false.

03:10.180 --> 03:12.740
And it could also be middle name colon null.

03:12.740 --> 03:14.660
So there's a few things to point out here.

03:14.700 --> 03:20.930
The first of them is that whenever you have strings text, you put double quotes around it like you

03:20.930 --> 03:21.290
see here.

03:21.330 --> 03:23.290
Like name and Alice have double quotes.

03:23.330 --> 03:25.210
Numbers do not have quotes.

03:25.210 --> 03:27.970
They are just numbers as it appears there.

03:28.410 --> 03:34.410
Uh, you could also see that that uh, booleans, trues and falses, they come as true and false in

03:34.410 --> 03:34.970
lowercase.

03:35.010 --> 03:37.010
Like, you see, they're false in lowercase.

03:37.050 --> 03:39.970
People from a Python background are used to it being a bit different.

03:39.970 --> 03:43.090
This is what it is in JavaScript, in JSON.

03:43.410 --> 03:47.970
And then that last one, null is a special thing that you're probably familiar with.

03:48.010 --> 03:49.570
That means kind of empty.

03:49.850 --> 03:53.290
And that is also a value, an acceptable value.

03:53.610 --> 03:55.210
So just a few things to point out.

03:55.250 --> 03:58.370
First of all, you need to use double quotes, not single quotes.

03:58.370 --> 04:00.410
And that's a little trap to watch out for.

04:00.610 --> 04:02.570
Uh, and also not curly quotes.

04:02.570 --> 04:07.930
If you type something in in many word processors, it will automatically convert your quote marks into

04:07.970 --> 04:12.530
curlies to go around the the words, and that will cause problems in JSON.

04:12.570 --> 04:14.610
They have to be straight up single quotes.

04:14.930 --> 04:22.480
True and false are in lowercase, and it's best practice when you have your keys to not have a space

04:22.480 --> 04:27.320
in your key, but to use something like the you see, I use the underscore here instead of a space for

04:27.360 --> 04:28.280
is student.

04:28.320 --> 04:29.760
Now it's actually allowed.

04:29.760 --> 04:35.240
You can have spaces in keys, but they tend to cause a few problems in various ways.

04:35.240 --> 04:37.600
That means that it's probably not worth the trouble.

04:37.640 --> 04:42.520
Better not to have spaces in the keys as a general principle.

04:42.560 --> 04:43.640
Okay, so that's number one.

04:43.640 --> 04:45.360
Key value pairs okay.

04:45.680 --> 04:47.640
Secondly, the object.

04:47.760 --> 04:51.800
So an object represents a thing with a bunch of key value pairs.

04:51.800 --> 04:55.040
And the way you write an object is using curly brackets.

04:55.080 --> 04:57.280
Curly braces as are sometimes known.

04:57.280 --> 05:00.680
So you open a curly brace it means okay I've got an object for you here.

05:00.680 --> 05:02.240
And then we have a key value pair.

05:02.280 --> 05:07.600
The name is Alice, and that comma at the end signifies that there's another key value pair to come.

05:07.720 --> 05:09.320
And it is age is 30.

05:09.360 --> 05:13.000
And then a comma there's more is student is false.

05:13.000 --> 05:15.760
And then a comma middle name is null.

05:15.760 --> 05:18.360
And then no comma means end of object.

05:18.360 --> 05:20.160
Close curly braces.

05:20.360 --> 05:22.880
And we are done defining this object.

05:22.920 --> 05:23.440
Okay.

05:23.480 --> 05:24.720
And just a few things to note.

05:24.720 --> 05:29.870
First of all, it's common to write it this way, with this kind of white space, with the things indented

05:29.870 --> 05:34.550
like this, so that it's really easy for humans like you and me to look at this and, and see what it

05:34.550 --> 05:38.390
means that it's an object, but it actually doesn't matter for the machine.

05:38.390 --> 05:41.910
You can choose to indent it and space things out with empty lines like this.

05:41.910 --> 05:43.550
Or you could write it all on one line.

05:43.550 --> 05:44.590
It's the same thing.

05:44.830 --> 05:50.670
And also, as I mentioned, it's it's worth noting that that last element there must not have a comma,

05:50.670 --> 05:51.830
that last key value pair.

05:51.950 --> 05:53.150
And again that's a difference.

05:53.150 --> 05:57.630
Some people in other programming languages, if you're Python, then you know that it's fine to put

05:57.630 --> 06:01.270
a comma at the end of the last entry, but not with JSON.

06:01.430 --> 06:01.710
Okay.

06:01.750 --> 06:02.950
That's number two okay.

06:02.990 --> 06:04.430
Number three is an array.

06:04.550 --> 06:05.990
And you probably know this.

06:06.150 --> 06:09.590
An array is something which has square brackets around it.

06:09.590 --> 06:13.630
So this would be an array of three fruits apples bananas oranges.

06:13.790 --> 06:16.830
You have an element and a comma another element comma another element.

06:17.070 --> 06:19.310
And here's here's another array.

06:19.350 --> 06:22.350
This is a series 11235 if you know what that is.

06:22.670 --> 06:23.910
And you can also mix.

06:23.910 --> 06:28.030
You can have numbers and booleans and text strings in there if you wish.

06:28.030 --> 06:29.190
That's another array.

06:29.390 --> 06:31.470
And you can write arrays like this.

06:31.470 --> 06:32.860
And sometimes people do.

06:32.860 --> 06:35.220
And so that would also make a good array.

06:35.420 --> 06:37.700
An array you can think of as like a value.

06:37.700 --> 06:39.420
So an array can be the value.

06:39.420 --> 06:43.660
If you have a key value pair, you could have something like favorite fruits as the key.

06:43.700 --> 06:46.420
And the value might be apples, bananas, oranges.

06:46.420 --> 06:50.260
That would be a good value for the key favorite fruits.

06:50.460 --> 06:58.580
And then finally, just to explain again that that it's it's fine to have things like lists which contain

06:58.780 --> 06:59.620
objects.

06:59.620 --> 07:04.500
So here's an example of a list which has two things in it two things and they are each objects.

07:04.500 --> 07:09.860
The first one is an object which has a name Alice, age 30, in blue there.

07:09.860 --> 07:13.340
And the second object is name Bob, age 35.

07:13.340 --> 07:18.180
And these are two different objects that are part of the array that I'm showing you there.

07:18.460 --> 07:22.900
And you can also have you can write it like this as well, which, which is a bit nicer, which is just

07:22.900 --> 07:27.060
to show that it is a array with two elements.

07:27.060 --> 07:29.220
The first one is Alice, the second one is Bob.

07:29.620 --> 07:34.420
And then similarly an object can contain other objects.

07:34.420 --> 07:35.740
So here is an object.

07:35.740 --> 07:37.370
This is some sort of an address.

07:37.370 --> 07:42.650
It has a street, a city and a country as three different keys in this object.

07:42.930 --> 07:46.170
And what we could do is we could have this object.

07:46.170 --> 07:47.210
Check this out.

07:47.210 --> 07:54.410
This is a single object, and it is something which has a name, age and address as three different

07:54.410 --> 07:59.330
keys in this object and that address key, the value for address.

07:59.370 --> 08:01.690
It's not text, it's not a number.

08:01.690 --> 08:02.570
It's not an array.

08:02.570 --> 08:03.610
It's not a boolean.

08:03.770 --> 08:06.290
It is itself an object in yellow.

08:06.290 --> 08:08.890
In fact, it's the same one as I put in the box above.

08:09.010 --> 08:14.970
It's that object which has street, city, country that is a smaller object, which is part of the bigger

08:14.970 --> 08:18.410
object which contains Alice and her age.

08:18.690 --> 08:25.370
So that gives you just a sense that objects can be made up of other objects, and of course also of

08:25.370 --> 08:25.970
arrays.

08:25.970 --> 08:28.570
And if you knew all this already, then congratulations.

08:28.570 --> 08:31.530
If you didn't, then hopefully this gave you just a bit of intuition.

08:31.570 --> 08:35.010
Don't worry about it, because we're going to see so much of this, it will become second nature.

08:35.370 --> 08:39.250
Just to give you some some of the lay of the land before we dive in.

08:39.650 --> 08:40.370
All right.

08:40.410 --> 08:42.770
Next up we're going to talk about expressions.
