Closed
Description
AB#1166328
Serializer puts base properties at the end. In JSON net you could create a contract resolver that let you change serialization order.
class Entity
{
public int Id { get; set; }
}
class Player : Entity
{
public string Name { get; set; }
}
class Program
{
static void Main(string[] args)
{
Console.WriteLine(System.Text.Json.JsonSerializer.Serialize(new Player {Id = 1, Name = "noname"}));
}
}
the output will be:
{"Name":"noname","Id":1}
instead of
{"Id":1,"Name":"noname"}
which is more readable