[MUSIC] So JSON as a format has several properties that are advantageous, one is that it's all Unicode, okay? So any JSON object, once you convert something into JSON, it's going to be represented all as Unicode characters, which is good because Unicode is understandable by people. In fact, that leads to another thing, it's generally human-readable, right? It's a human could look at the JSON format and understand, for the most part, what it is. It might be slightly complicated, but it's readable by a human. Now it's also a fairly compact representation. I say fairly compact, because it's not completely compact, if it were the most compact, then it wouldn't be human readable anymore. So if you took the JSON object and just compressed it, you would get something that was smaller, but you couldn't read it, okay? So it's fairly compact. It's human readable, it's as small as you're going to get and still be human readable, put it like that. So, the types inside JSON can be combined recursively. When I say the types, the different types of data that you're putting together. So, remember that in JSON we're going to want to represent these different data structures that we have, these objects that we have in Golang, we're going to want to represent them as JSON objects. So they can be combined recursively. So you can have an array of integers or an array of structures or a structure with structures inside or a structure with arrays inside and integers and strings. So you can combine them all heirarchively, right? A structure with structures inside which have other structures inside and so on So you can get arbitrarily complex golang objects and convert them into JSON, so that's a pretty good advantage. So JSON marshalling, marshalling, the term marshalling, means to, and in this case, in JSON marshalling, you're generating JSON, a JSON representation from an object, in our case a go object, right? So we've got some object arbitrarily complex in go, we want to turn it into something that adheres to JSON format, right? So that's called marshalling, JSON marshalling. So in this example, we're going to start off with our person struct, and here's the general structure. Type struct's got a name, address, phone, they're all strings and this is the structure. So let's say we create, we have an actual person, an object of this particular structure of this type. And this person, p1, it has a particular name, joe, address, a st., phone, 123, we've seen this before. So now we want to take this person, destruct, and we want to make it, turn it into a JSON object. So we call this function JSON Marshal, json.Marshal. And notice if we pass this as an argument, we pass p1. The golang structure that we want to convert, we pass that as an argument to JSON Marshal and it returns two things. In this case, the first thing is B array, I'm calling it next as error. So the error it's a nil if there's no error. If it converts properly, then there should be a nil. There will be no error and what it returns is B array It's actually going to be a byte array which contains the JSON representation. Remember that JSON is all in unicode, so this byte array is a bunch of ruins, basically, an array of them, and that is the JSON representation. So, what json.Marshal does is it takes a golang object, returns you a JSON representation. So JSON unmarshalling is going in the opposite direction. What you're trying to do is you take some byte array which contains a JSON object, and you want to convert that into a golang object, right, which store the same information. So going from the last slide, we're again talking about this person struct. So let's say we have already made our barr, our B array, and that's a person, okay? It's a JSON representation of a person. Now we want to Unmarshal it, so we want to take this JSON representation and create a Golang struct which contains the same information. So what we do is we declare that golang struct. Up at the top we say var p2, we'll call it p2, person. So it's a person but we haven't created it yet, we haven't filled in the name, address, phone yet. So we just have a person and it's basically empty, then we call json.unmarshall. Now notice there are two arguments for pass onto json.Unmarshall. First argument is, the B array, which is the actual byte array, which contains the JSON object. The second argument is the address of the Go structure, that we want the results to be placed into. So, address of p2. because remember that this b array contains information about a person, we want that to be put into this p2 that we've created, that is, as of now, empty. So when you call it it just basically unpacks the v array and puts the attribute values into the appropriate fields of the person structure p2. Now, one constraint is that this p2, whatever the second argument is to Unmarshal, it needs to fit the JSON data, the JSON byte array. When I say fit, I mean the JSON object is going to have a set of attributes and values of those attributes. P2 Second arguement, it's got to have the same attributes, so if it's a struct in this case, it's gotta have, those have to be the field name. So if the JSON object has an attribute called name, then the Goliang object P2, it better have a field called name, right? So that's the idea, so it has to fit. But if it does, then what will happen if you call unmarshall and then in the end P2 will contain, will be a struct with all the information that was contained in the JSON object. And that error value that is returned by json.Unmarshal is nil if everything works, if everything fits. If it doesn't fit, it will throw an error. Thank you.