Allowing ToByteArray()-like serialization in addition to Json serialization.