The quickest method of converting between JSON text and a .NET object is using the T:Newtonsoft.Json.JsonSerializer. The JsonSerializer converts .NET objects into their JSON equivalent and back again by mapping the .NET object property names to the JSON property names and copies the values for you.

# JsonConvert

For simple scenarios where you want to convert to and from a JSON string the Overload:Newtonsoft.Json.JsonConvert.SerializeObject and Overload:Newtonsoft.Json.JsonConvert.DeserializeObject methods on JsonConvert provide an easy to use wrapper over JsonSerializer.

Serializing and Deserializing JSON with JsonConvert

SerializeObject and DeserializeObject both have overloads that take a T:Newtonsoft.Json.JsonSerializerSettings object. JsonSerializerSettings lets you use many of the JsonSerializer settings listed below while still using the simple serialization methods.

# JsonSerializer

For more control over how an object is serialized the T:Newtonsoft.Json.JsonSerializer can be used directly. The JsonSerializer is able to read and write JSON text directly to a stream via T:Newtonsoft.Json.JsonTextReader and T:Newtonsoft.Json.JsonTextWriter. Other kinds of JsonWriters can also be used such as T:Newtonsoft.Json.Linq.JTokenReader/T:Newtonsoft.Json.Linq.JTokenWriter to convert your object to and from LINQ to JSON objects or T:Newtonsoft.Json.Bson.BsonReader/T:Newtonsoft.Json.Bson.BsonWriter to convert to and from BSON.

Serializing JSON to a Stream with JsonSerializer

JsonSerializer has a number of properties on it to customize how it serializes JSON. These can also be used with the methods on JsonConvert via the JsonSerializerSettings overloads.

Read more about the available JsonSerializer settings here: Serialization Settings SerializationSettings.htm _self

Serialization Guide
SerializationGuide.htm
_self
Serialization Settings
SerializationSettings.htm
_self
Serialization Attributes
SerializationAttributes.htm
_self
Serializing Partial JSON Fragments
SerializingJSONFragments.htm
_self
T:Newtonsoft.Json.JsonConvert
T:Newtonsoft.Json.JsonSerializer
T:Newtonsoft.Json.JsonSerializerSettings