简体   繁体   中英

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM