1
00:00:01,310 --> 00:00:07,070
In this section we will talk about interpreting the Jason encoded data

2
00:00:09,720 --> 00:00:12,450
javascript object and notation.

3
00:00:12,450 --> 00:00:18,930
Jason attempts to strike a balance between human and mission readability.

4
00:00:19,110 --> 00:00:27,990
Armed with a fear Jason rules most humans can read Jason data moved past simply guessing at what it

5
00:00:27,990 --> 00:00:35,160
means and confidently interpret the data structures defined by the Jason data.

6
00:00:35,160 --> 00:00:44,160
At the same time Jason data makes it easy for programs to convert Jason text into variables making it

7
00:00:44,160 --> 00:00:52,980
very useful for data exchange between applications using API ice you can find the details of Jason in

8
00:00:53,100 --> 00:01:03,840
our FC 8 2 5 9 and in a number of sites found with the Internet searches including the w w w that Jason

9
00:01:03,870 --> 00:01:07,460
that arc saw.

10
00:01:07,820 --> 00:01:15,890
Let's start with the interpreting to Jason as the data flows back and forth between our application

11
00:01:15,920 --> 00:01:17,740
and the network controller.

12
00:01:17,810 --> 00:01:23,000
That data is commonly written in Jason data format.

13
00:01:23,120 --> 00:01:32,990
You can't think of that skill and that the task with two major branches first even ignoring the syntax

14
00:01:33,050 --> 00:01:41,780
and spatial characters anyone who knows the topic can probably make an intelligent guesses about the

15
00:01:42,170 --> 00:01:49,970
meaning of many of the key Valley pairs for example without knowing anything about Jason's syntax.

16
00:01:49,970 --> 00:01:57,440
You could probably do to mine from your prior knowledge of Cisco or others and switches that the Jason

17
00:01:57,470 --> 00:02:07,260
on the screen that lists to the wise maybe they are just names and a list of interfaces on each device.

18
00:02:07,280 --> 00:02:09,670
You can see in here this is Jason.

19
00:02:09,770 --> 00:02:12,860
Yep but we have our one.

20
00:02:13,090 --> 00:02:13,510
Probably.

21
00:02:13,520 --> 00:02:16,610
That's the host name are two.

22
00:02:16,640 --> 00:02:25,790
That's also the house name and the interfaces of the rather one and these are the interfaces of the

23
00:02:26,090 --> 00:02:28,150
rather two right.

24
00:02:28,160 --> 00:02:28,680
Okay.

25
00:02:28,730 --> 00:02:37,070
Honestly you probably already know everything needed to do this kind of intelligent guessing.

26
00:02:37,070 --> 00:02:45,590
However to perform the second type of task where you analyze the adjacent data to find the data structures

27
00:02:45,860 --> 00:02:54,460
including objects lists and key value pairs you need to know a bit more about Jason's syntax.

28
00:02:54,620 --> 00:03:00,680
So let's go ahead with the key value pairs in Jason's syntax guys.

29
00:03:00,680 --> 00:03:09,680
Each and every column identifies one key value pair with the key before the column and the value after

30
00:03:09,680 --> 00:03:18,130
the column so you can see in here we have one true and three key value pairs.

31
00:03:18,160 --> 00:03:24,050
These are the keys and these are the values.

32
00:03:24,170 --> 00:03:30,530
So first best is the key and messy is the value.

33
00:03:30,530 --> 00:03:35,200
Second best is the key run out low is the value.

34
00:03:35,210 --> 00:03:39,130
Third best is the key and Pella is the value.

35
00:03:39,750 --> 00:03:45,630
Okay let's go ahead with the key key is the text inside.

36
00:03:45,640 --> 00:03:48,030
Double quotes before the column.

37
00:03:48,080 --> 00:03:52,020
Use that as the name that area for instance value.

38
00:03:52,060 --> 00:03:52,500
Okay.

39
00:03:52,510 --> 00:03:56,800
We have already talked about this one that should be in.

40
00:03:57,160 --> 00:04:05,510
Yes key should be inside the double quotes and this is our key and you can see it's inside the double

41
00:04:05,870 --> 00:04:13,560
codes and that is before the double column you can see in here.

42
00:04:13,670 --> 00:04:22,570
So inside the double quotes and before the Colum.

43
00:04:22,940 --> 00:04:32,790
Okay so let's go ahead with the value volley is the item after the column that represents the value

44
00:04:32,810 --> 00:04:42,860
of the key which can be a volley can be and taxed guys that should be listed in double quotes like in

45
00:04:43,160 --> 00:04:48,290
here and volley also can be numeric.

46
00:04:49,200 --> 00:05:00,160
If our volley is numeric that is listed without chords that can be an array and object and they are

47
00:05:00,210 --> 00:05:09,900
as some special values then we will talk about more details on our later sections okay on Jason's syntax

48
00:05:09,900 --> 00:05:17,130
when we need to list multiple key value pairs we need to separate the pairs with a comma and NE as you

49
00:05:17,130 --> 00:05:25,830
can see in here the first comma and the second comma but whereas the third comma we don't use the comma

50
00:05:25,950 --> 00:05:32,230
at the end of the last key value pair okay.

51
00:05:32,240 --> 00:05:42,890
Let's go ahead with some more information we have objects and the array terms object is a series of

52
00:05:42,890 --> 00:05:53,550
key value pairs and close to in an matched pair of curly brackets here is the thing that we need to

53
00:05:53,610 --> 00:05:54,440
care about.

54
00:05:54,450 --> 00:06:01,500
Objects should be inside the color brackets guys with an opening left curly bracket and it's matching

55
00:06:01,510 --> 00:06:11,520
right color bracket when it comes to array array is as series of values not key value pairs.

56
00:06:11,960 --> 00:06:12,410
Okay.

57
00:06:12,420 --> 00:06:20,550
Pay attention this one and enclose the in a matched pair of square brackets.

58
00:06:20,550 --> 00:06:29,040
This time with an opening left screen bracket and its matching right square bracket.

59
00:06:29,150 --> 00:06:33,260
So what about the key value pairs inside the objects.

60
00:06:33,260 --> 00:06:40,300
All key value pairs inside an object conform to the earlier rules for the key value pairs.

61
00:06:40,310 --> 00:06:49,930
We talked already and all values inside inside the arrays conform to the earlier rules for formatting

62
00:06:49,930 --> 00:06:50,780
values.

63
00:06:50,800 --> 00:06:59,590
For example double quotes around tags no quotes around the numbers are okay below the screen shows a

64
00:06:59,590 --> 00:07:02,200
single array in Jason format.

65
00:07:02,200 --> 00:07:06,310
In here you can see a single array in Jason format.

66
00:07:06,370 --> 00:07:09,100
Notice the Jason data begins with

67
00:07:12,330 --> 00:07:24,910
two square brackets and then lists three text values in here they are messy Ronaldo and d blah and the

68
00:07:24,910 --> 00:07:32,200
values could have been a mix of values and it ends with another square bracket

69
00:07:36,490 --> 00:07:46,660
while example on previous slide shows only the array itself Jason arrays can be used as a value in any

70
00:07:46,660 --> 00:07:56,530
key value pair figure on the screen does just that and shown in a graphic to elo is here highlighting

71
00:07:56,680 --> 00:07:59,490
of the arrays and the objects.

72
00:07:59,800 --> 00:08:10,750
The Jason text in the figure includes two arrays as values and a these values each from just after column

73
00:08:10,840 --> 00:08:13,730
indicating they are values really.

74
00:08:13,750 --> 00:08:16,600
So here is the first Jason array.

75
00:08:16,630 --> 00:08:20,410
So here it is.

76
00:08:21,200 --> 00:08:22,430
Jason array with

77
00:08:25,940 --> 00:08:30,460
please pay attention to start and finish at the first Jason array.

78
00:08:30,650 --> 00:08:36,890
And this is the first for favorite players and they are messy Ronaldo and Bella.

79
00:08:37,370 --> 00:08:46,430
And this is the second Jason array and it's the favorite teams and they are Barcelona U.N. those and

80
00:08:46,430 --> 00:08:48,480
the document.

81
00:08:48,500 --> 00:08:53,780
So now let's think about the entire structure of the Jason data.

82
00:08:53,780 --> 00:09:04,100
In previous slide it has a matched pair of Charlie brackets to begin and end the text encapsulating

83
00:09:04,100 --> 00:09:08,990
one object that object contains two columns.

84
00:09:08,990 --> 00:09:13,810
So there are two key value pairs inside the object.

85
00:09:14,000 --> 00:09:21,980
When you think about the broader structure as depicted in the figure on the screen you can see now this

86
00:09:21,980 --> 00:09:29,240
Jason File has one Jason object itself with two key value pairs.

87
00:09:29,450 --> 00:09:36,390
Please note that this figure does not show the correct Jason's syntax for the lists.

88
00:09:36,500 --> 00:09:46,040
It instead is intended to make sure used to see the structure of the one object and its two key value

89
00:09:46,070 --> 00:09:52,090
pairs to drive home the idea of how to find Jason objects.

90
00:09:52,100 --> 00:09:56,210
You can consider the examples shown in this slide.

91
00:09:56,210 --> 00:10:02,110
This figure shows the correct Jason's syntax guys and it has the following.

92
00:10:02,180 --> 00:10:10,460
There is one object for the entire set because it begins and ends with curly braces.

93
00:10:10,460 --> 00:10:11,570
You can see it in here

94
00:10:14,800 --> 00:10:24,790
then the outer object has two keys and the first key is when those favorites and the second key is the

95
00:10:24,910 --> 00:10:25,930
interface config.

96
00:10:26,650 --> 00:10:31,910
The value of each key value pair is another object.

97
00:10:32,380 --> 00:10:49,320
So each with curly braces and you can see them here here and here and also we have three key value pairs.

98
00:10:49,400 --> 00:10:50,310
Key value pair.

99
00:10:50,320 --> 00:10:57,570
1 2 3 key value pair 1 2 3 OK.

100
00:10:57,620 --> 00:11:04,700
The Jason example in this slide shows how Jason can list objects and arrays.

101
00:11:04,850 --> 00:11:10,940
That is Jason puts one object or array inside another.

102
00:11:10,940 --> 00:11:19,580
Much of the Jason output you will see as you learn more and more about network automation will include

103
00:11:19,610 --> 00:11:25,550
Jason data with nested arrays and objects okay.

104
00:11:25,580 --> 00:11:31,420
So far all the Jason examples show lots of empty space.

105
00:11:31,430 --> 00:11:38,840
Jason allows for white space or not depending on your needs for humans.

106
00:11:38,840 --> 00:11:47,860
Reading Jason can be a lot easier with the text organized with space and light for instance having the

107
00:11:47,870 --> 00:11:56,510
match to opening and closing brackets sit at the same left offset makes it much easier to find which

108
00:11:56,510 --> 00:12:03,040
brackets go with which when stored in a file or sent in a network.

109
00:12:03,050 --> 00:12:11,810
Jason does not use whitespace For instance earlier in the section figure on a bow of the screenshot

110
00:12:11,820 --> 00:12:12,100
one.

111
00:12:12,230 --> 00:12:22,040
Jason object with three key value pairs with what space taking five lines however stored in a file or

112
00:12:22,040 --> 00:12:23,710
send over and network.

113
00:12:23,720 --> 00:12:28,460
The Jason will look like as the low of the screen.

114
00:12:28,460 --> 00:12:35,830
Most of the tools you might use when working with Jason will let you toggle from our printed format

115
00:12:36,080 --> 00:12:42,150
which is good for humans to air rare round format which is good for computers.

116
00:12:42,260 --> 00:12:50,840
You might see the printed version literally called pretty or a bit of white or spaced while the version

117
00:12:50,840 --> 00:12:55,850
with no extra whitespace might be called meaning fight or ROF.
