Skip to content

Instantly share code, notes, and snippets.

@Adam--
Created February 17, 2022 16:26
Show Gist options
  • Save Adam--/ef72b32803a3dc0fd94553354770d368 to your computer and use it in GitHub Desktop.
Save Adam--/ef72b32803a3dc0fd94553354770d368 to your computer and use it in GitHub Desktop.
#r "nuget:Newtonsoft.Json, 13.0.1"
using Newtonsoft.Json;
public class Product
{
public string Name { get; set; }
public DateTime Expiry { get; set; }
public string[] Sizes { get; set; }
}
Product product = new Product
{
Name = "Apple",
Expiry = new DateTime(2008, 12, 28),
Sizes = new string[] { "Small" },
};
var json = JsonConvert.SerializeObject(product);
Console.WriteLine(json);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment