This is a test suite for benchmarking various Go serialization methods.
https://alecthomas.github.io/go_serialization_benchmarks
go test -bench=.
To validate the correctness of the serializers:
VALIDATE=1 go test -bench=. -benchtime=1ms
To update the benchmark report:
go test -tags genreport -run TestGenerateReport
If correctness and interoperability are the most important factors JSON or Protobuf are your best options.
But as always, make your own choice based on your requirements.
The data being serialized is the following structure with randomly generated values:
type A struct {
Name string
BirthDay time.Time
Phone string
Siblings int
Spouse bool
Money float64
}