JSON data serialization

Serialization is an important process which allows the developer to encode application objects to a text format that can be saved to file, database or sent to a remote server. On the contrary, deserialization allows the developer to decode back this text into an object. In this post, I would like to show you a quick tip how to serialize objects in any .NET application.


Nowadays, JSON format is one of the most used in mobile application development and unlike XML’s object representations consumes less space, what can be useful especially when sending data to the server.


  1. First of all, mark your class with [DataContract] attribute and it’s members you want to be stored with [DataMember] attribute.
  2. Create help class JsonHelper.cs which will provide encoding functions.
  3. Convert object to JSON string.
  4. Convert JSON string back to an object.

That’s all! Hope it helps.