I am using Boost ASIO as a TCP server networking solution.
Here is how I serialize a struct in C++:
struct AccountRole { int id; std::string name;