Closed Matt-Crow closed 8 months ago
Serialization behavior is intentional: https://github.com/dotnet/runtime/issues/31742
Alternatively, a custom object serialization solution could help remove all the fat associated with JSON keys:
{
"key1": value1,
"key2": value2
}
versus
// server
objectStream.Write(value1);
objectStream.Write(value2);
// client
const valueForKey1 = objectStream.read();
const valueForKey2 = objectStream.read();
The client just has to know exactly what to expect on each read.
Currently, serializing C# objects as JSON requires either generics or type annotations, but these are sub-optimal. Find a better way of doing this.