Provides methods for converting between common language runtime types and JSON types.
Namespace: Newtonsoft.JsonAssembly: Newtonsoft.Json (in Newtonsoft.Json.dll) Version: 4.5.0.0 (4.5.11.15729)
Syntax
| C# |
|---|
public static class JsonConvert |
| Visual Basic |
|---|
Public NotInheritable Class JsonConvert |
| Visual C++ |
|---|
public ref class JsonConvert abstract sealed |
Examples
CopySerializing and Deserializing JSON with JsonConvert
1Product product = new Product();
2
3product.Name = "Apple";
4product.ExpiryDate = new DateTime(2008, 12, 28);
5product.Price = 3.99M;
6product.Sizes = new string[] { "Small", "Medium", "Large" };
7
8string output = JsonConvert.SerializeObject(product);
9
10
11
12
13
14
15
16
17
18
19
20Product deserializedProduct = JsonConvert.DeserializeObject<Product>(output);
Inheritance Hierarchy
See Also