Skip to content

Instantly share code, notes, and snippets.

@geoffreymcgill
Created August 16, 2017 23:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save geoffreymcgill/c7551f10ddef5abf24a345182ac5556e to your computer and use it in GitHub Desktop.
Save geoffreymcgill/c7551f10ddef5abf24a345182ac5556e to your computer and use it in GitHub Desktop.
Product product = new Product();
product.Name = "Apple";
product.ExpiryDate = new DateTime(2008, 12, 28);
product.Price = 3.99M;
product.Sizes = new string[] { "Small", "Medium", "Large" };
string output = JsonConvert.SerializeObject(product);
//{
// "Name": "Apple",
// "ExpiryDate": "2008-12-28T00:00:00",
// "Price": 3.99,
// "Sizes": [
// "Small",
// "Medium",
// "Large"
// ]
//}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment