55

What is the difference between serializing and encoding? When should I use each in a web service?

codeforester
  • 39,467
  • 16
  • 112
  • 140
Rodniko
  • 4,926
  • 20
  • 69
  • 93

1 Answers1

44

Serializing is about moving structured data over a storage/transmission medium in a way that the structure can be maintained. Encoding is more broad, like about how said data is converted to different forms, etc. Perhaps you could think about serializing being a subset of encoding in this example.

With regard to a web service, you will probably be considering serializing/deserializing certain data for making/receiving requests/responses - effectively transporting "messages". Encoding is at a lower level, like how your messaging/web service type/serialization mechanism works under the hood.

Matt Kocaj
  • 11,278
  • 6
  • 51
  • 79
  • What serialization method does http & tcp use? Or is that not defined by those protocols, and instead left up to the implementation of the client and server software? – pastacompany Aug 26 '21 at 14:09