using System;
using System.Text.Json;
public class Program
{
public static void Main()
Foo foo = new Foo();
JsonSerializerOptions o = new JsonSerializerOptions
IncludeFields = true
};
String json = System.Text.Json.JsonSerializer.Serialize( foo, options: o );
Console.WriteLine( json );
}
internal class Foo
public String Field = "abc";
// You can define other methods, fields, classes and namespaces here