There are various libraries supporting type-safe serialization, with varying degrees of efficiency and need for manual intervention: