If I have an object
public class Car
{
public int Speed = 0;
}
and then serialize this as following:
var str = JsonConvert.SerializeObject(new Car(), new JsonSerializerSettings { TypeNameHandling = TypeNameHandling.All });
I would get an JSON looking something like this:
{
"$type":"Car",
"Speed": 0
}
I would like to upload this JSON-data to for example Firebase Realtime Database, but it doesn't allow the usage of '$' in keys.
How would I best replace "$type" with something custom like "typeKey"? But still be able to convert the JSON-data into objects when deserializing and make it use type information from the new key ("typeKey" instead of it looking for "$type")?