❔ Can someone explain to me what serialization and deserialization means?
Hello guys, I watched some tutorials on this concept, but they're using JSON data and didn't quite understand it.
33 Replies
You know what objects are, right?
They're in essence just pieces of data
Definitely I do
OK
Serialization => turning an object into a string or bytes
Deserialization => turning a string or bytes into an object
its very way common to save objects, or send them to another program
Aha!
But guys, what is the goal of this? Objects are instantiated from classes and we use them to pass arguments for our ctor.
objects is how you move data around
a good example is getting data from the internet
if Thinker here makes a cool api that I can use to get information about pokemons for example, I can make a request to that and he sends me a lot of JSON back
I can then deserialize that JSON into an object
For example, I'm importing data from a text file and then I need create books by instantiating objects, where is the role of these concpets in this scenario?
you are essentially doing deserialization
but you are doing it the manual way, since the data in your text file doesnt follow an established format (like JSON, XML, YAML etc)
And the benefit is that it doesn't matter what programming language Pobiega is using, the text sent back is just a string which can be deserialized however you want.
and since we are using a standard format (JSON), anyone can very easily understand how it works
most if not all programming languages can easily ser/deser to/from json these days
Aha! Ok! I almost got the idea.
That's why I see many people talk about JSON here in the c# server.
yes, its the most common format these days
and its the default language for the web
here is some examples
https://dummyjson.com/products/1
https://dummyjson.com/products/search?q=Laptop
So this applies perfectly to my case by reading data from text file + importing them + access them by indices + turning them into objects like books, am I correct?
no
because your file isnt in JSON format
No, it's not actually. It's just a text file data written.
yeah, I know. And thus, you can't use a json deserializer to read it
because a json deserializer only reads json.
an xml deserializer only reads xml.
etc
your format can be called
Triple Hash separated values
😄we already joked about it being the "THSV" format in the old thread 😄
😆 yeah you could call it like that.
Hahaha
there is an older format called "CSV" which stands for "comma separated values"
which is why it was "funny"
Oh! Some wrote this to me, I remember and I had no idea what it means.
Ok
I guess I will learn more about these two concepts more deeply when I get in touch with database and JOSN 😁
God, all the time I meet new stuff and never ends like encapsulation, polymorphism and now these two.
This is programming.
There are always new things to learn
😄
you will never learn it all. thats just reality.
so you pick the topics that are relevant to you and your path
I do very little lowlevel programming, and I actively avoid frontend web development and graphics programming
It makes it fun to adventure through programming like if we had only c# fundamentals, it would've been very boring, so these stuff adds fun to it.
Really! So you mean you're working mostly backend like database stuff?
My full time job is all backend work yes
but its much much more than just databases
Really! OMG I don't wanna hear any complex stuff, I get afraid that I won't understand them 😆
the backend is usually responsible for all/most of the application logic. the frontend is for showing the data and collecting input
neither of these is "just" thou, they are both big complicated fields
Ok! Interesting to collect these informations. But you get to pick either one and worry about one field instead of full-stack development.
Yes
Full-stack is... very complicated.
I have met very few good full-stack developers who knew both domains well
instead you usually see fullstack juniors who just know the basics of both and use that to find a job that later specialize them
Aha! Ok! Yeah! I can imagine how complicated this mission is in a career level particularly. But I think many people learn at work than setting home and read books, watch tutorials. Work place teaches you practically how to do stuff, just like you showed me on the live screen 😁
yes and no
you learn a lot at work ofc, because you are there for ~40 hours a week
but at a job they will expect you to learn FAST. Like, very fast.
Really! Like learn and then apply what you have learned ride away without spending too much time on a single problem, right?
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.