In this topic I will talk about a very nice project that is done by Google which is Protocol Buffers...
What is Protocol Buffer?
Its a method of serializing structured data in an efficient, fast, and simple way where you can control how the object looks like using a predefined language.
So basically you define the object structure using a language which called "Interface description language" and usually its written in files with extension .proto and can be then compiled using protoc utility to generate Java, C++, Python class files, and to create instances you can use the builder class generated along with the generated classes.
Interface description language
A simple way to define the fields, types, and in case required or optional and you also have to assign sequence number for the tool to uniquely identify each of them when serializing and de-serializing. You can see the example below and read more about the language to develop more advanced object types.
I would say this is a good way to serialize and de-serialize objects to be totally independent of the language used especially in systems that involve communication between heterogeneous systems which may be developed with different technologies and/or languages.
First you need to install protocol buffer compiler using the following command:
sudo apt-get install protobuf-compiler