using System;
using System.Text.Json;
public class Program
{
public static void Main()
var values = new object[]
new A { PropertyA = "A value" },
new B { PropertyB = "B value" },
};
Console.WriteLine(JsonSerializer.Serialize(values));
}
public class A
public string PropertyA { get; set; }
public class B
public string PropertyB { get; set; }