using Newtonsoft.Json.Serialization;
public static void Main()
var myClass = new MyClass
AnotherName = "pineapple",
AnotherValue = "not as delicious as the apple"
var json = JsonConvert.SerializeObject(myClass, Formatting.Indented);
[JsonObject(MemberSerialization.OptIn)]
public string SomeName { get; set; }
public string SomeValue { get; set; }
public string AnotherName { get; set; }
public string AnotherValue { get; set; }