Answers for "JSON stringify c# .net"

C#
1

json stringify c#

JsonConvert.SerializeObject(item)
Posted by: Guest on May-06-2020
0

JSON stringify c# .net

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"
//  ]
//}

Product deserializedProduct = JsonConvert.DeserializeObject<Product>(output);
Posted by: Guest on October-25-2021

C# Answers by Framework

Browse Popular Code Answers by Language