Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Preview
Start a free Courses trial
to watch this video
Get an overview of serialization.
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
[MUSIC]
0:00
In the previous set of videos,
we read data from a CSV file and
0:04
created in memory objects with it.
0:09
In computer programming,
the need to save or
0:11
load data that is stored
somewhere is common.
0:14
When we save data from in memory objects
0:17
to another format that can be retrieved
later that is called serialization.
0:20
Conversely, the process of loading
serialized data is deserialization.
0:25
Technically when we read the soccer
game result data from the CSV file,
0:31
we deserialized it into
objects in our program.
0:35
Programmers usually wouldn't refer
to that as serialization though
0:39
because we didn't use
a serializer to process the data.
0:42
We wrote the processing logic ourselves.
0:46
A serializer is something that
knows how to translate the objects
0:49
into a specific format.
0:52
Common formats we use in .NET for
serialization our JSON and XML.
0:54
Both are considered to be human readable
which means we can look at the files and
0:59
interpret the data without assistance.
1:04
In .NET there's also binary serialization,
1:07
which saves the data as
bytes to a binary file.
1:10
If you tried to open up the file as text,
it wouldn't be readable.
1:13
As we learn about serialization,
we'll be using streams
1:17
to transport our data from
the source format into our program.
1:21
In the videos that follow we'll be
using JSON as our serialization format.
1:26
JSON is quickly becoming
the preferred format for
1:31
serialization in .NET but
you might also come across XML.
1:33
I've linked to some more resources for
serializing to XML in the notes.
1:38
The concept is mostly the same.
1:43
You'll need a source stream,
an XML serializer and an output stream.
1:44
JSON stands for
JavaScript object notation and
1:50
is derived from the JavaScript language.
1:53
If you've used JavaScript before
it will look really familiar.
1:55
If not,
don't worry it's really easy to pick up.
1:59
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up