Created
February 17, 2022 16:26
-
-
Save Adam--/ef72b32803a3dc0fd94553354770d368 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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