Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deserialization vs. parsing

As far as I understand, deserialization is turning a stream of bytes into an object.

Parsing is kinda the same, usually turning a string into some data structure.

Is parsing a type of deserialization? Can you consider them synonymous?

like image 236
daremkd Avatar asked Mar 30 '16 09:03

daremkd


People also ask

What is the difference between parsing and serialization?

Use a parser to read XML from a character stream into data structures; use a serializer to write data structures out into a character stream.

What is the meaning of deserialization?

Deserialization is the opposing process which takes data from a file, stream or network and rebuilds it into an object. Serialized objects can be structured in text such as JSON, XML or YAML. Serialization and deserialization are safe, common processes in web applications.

What is the difference between serialize and deserialize?

Serialization is a mechanism of converting the state of an object into a byte stream. Deserialization is the reverse process where the byte stream is used to recreate the actual Java object in memory. This mechanism is used to persist the object. The byte stream created is platform independent.

What does it mean to deserialize JSON?

The process whereby a lower-level format (e.g. that has been transferred over a network, or stored in a data store) is translated into a readable object or other data structure. In JavaScript, for example, you can deserialize a JSON string to an object by calling the function JSON.


1 Answers

Parsing is the more general term.

Deserialization is commonly used in the context of object oriented languages. The result of deserialization is an object while the result of parsing can be any type of data.

Even in the context of object creation, parsing is more general. If for example you create an object and only part of the data required by the constructor is parsed from a file while the rest of the data is provided as user input, I wouldn't call it deserialization.

like image 170
Frank Puffer Avatar answered Sep 28 '22 08:09

Frank Puffer