using System.Text.Json.Serialization;
using System.Collections.Generic;
public static void Main()
var people = new List<Person>{
new Person{ Id = 1, Name = "One", Gender = Gender.Male },
new Person{ Id = 2, Name = "Two", Gender = Gender.Female },
new Person{ Id = 3, Name = "Three" }
var text = JsonSerializer.Serialize(people);
public string Name {get; set;}
[JsonConverter(typeof(JsonStringEnumConverter))]
public Gender Gender {get;set;}