Click or drag to resize
Json.NETJsonSerializer Class
 
Serializes and deserializes objects into and from the JSON format. The JsonSerializer enables you to control how objects are encoded into JSON.
Inheritance Hierarchy
SystemObject
  Newtonsoft.JsonJsonSerializer

Namespace: Newtonsoft.Json
Assembly: Newtonsoft.Json (in Newtonsoft.Json.dll) Version: 7.0.0.0 (7.0.1.18129)
Syntax
C#
public class JsonSerializer

The JsonSerializer type exposes the following members.

Constructors
  NameDescription
Public methodJsonSerializer
Initializes a new instance of the JsonSerializer class.
Top
Methods
  NameDescription
Public methodStatic memberCreate
Creates a new JsonSerializer instance. The JsonSerializer will not use default settings.
Public methodStatic memberCreate(JsonSerializerSettings)
Creates a new JsonSerializer instance using the specified JsonSerializerSettings. The JsonSerializer will not use default settings.
Public methodStatic memberCreateDefault
Creates a new JsonSerializer instance. The JsonSerializer will use default settings.
Public methodStatic memberCreateDefault(JsonSerializerSettings)
Creates a new JsonSerializer instance using the specified JsonSerializerSettings. The JsonSerializer will use default settings.
Public methodDeserialize(JsonReader)
Deserializes the Json structure contained by the specified JsonReader.
Public methodDeserialize(TextReader, Type)
Deserializes the Json structure contained by the specified StringReader into an instance of the specified type.
Public methodDeserialize(JsonReader, Type)
Deserializes the Json structure contained by the specified JsonReader into an instance of the specified type.
Public methodDeserializeT(JsonReader)
Deserializes the Json structure contained by the specified JsonReader into an instance of the specified type.
Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodPopulate(TextReader, Object)
Populates the JSON values onto the target object.
Public methodPopulate(JsonReader, Object)
Populates the JSON values onto the target object.
Public methodSerialize(TextWriter, Object)
Serializes the specified Object and writes the Json structure to a Stream using the specified TextWriter.
Public methodSerialize(JsonWriter, Object)
Serializes the specified Object and writes the Json structure to a Stream using the specified JsonWriter.
Public methodSerialize(TextWriter, Object, Type)
Serializes the specified Object and writes the Json structure to a Stream using the specified TextWriter.
Public methodSerialize(JsonWriter, Object, Type)
Serializes the specified Object and writes the Json structure to a Stream using the specified TextWriter.
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Top
Properties
  NameDescription
Public propertyBinder
Gets or sets the SerializationBinder used by the serializer when resolving type names.
Public propertyCheckAdditionalContent
Gets a value indicating whether there will be a check for additional JSON content after deserializing an object.
Public propertyConstructorHandling
Gets or sets how constructors are used during deserialization.
Public propertyContext
Gets or sets the StreamingContext used by the serializer when invoking serialization callback methods.
Public propertyContractResolver
Gets or sets the contract resolver used by the serializer when serializing .NET objects to JSON and vice versa.
Public propertyConverters
Gets a collection JsonConverter that will be used during serialization.
Public propertyCulture
Gets or sets the culture used when reading JSON. Defaults to InvariantCulture.
Public propertyDateFormatHandling
Get or set how dates are written to JSON text.
Public propertyDateFormatString
Get or set how DateTime and DateTimeOffset values are formatting when writing JSON text.
Public propertyDateParseHandling
Get or set how date formatted strings, e.g. "\/Date(1198908717056)\/" and "2012-03-21T05:40Z", are parsed when reading JSON.
Public propertyDateTimeZoneHandling
Get or set how DateTime time zones are handling during serialization and deserialization.
Public propertyDefaultValueHandling
Get or set how null default are handled during serialization and deserialization.
Public propertyFloatFormatHandling
Get or set how special floating point numbers, e.g. NaN, PositiveInfinity and NegativeInfinity, are written as JSON text.
Public propertyFloatParseHandling
Get or set how floating point numbers, e.g. 1.0 and 9.9, are parsed when reading JSON text.
Public propertyFormatting
Indicates how JSON text output is formatted.
Public propertyMaxDepth
Gets or sets the maximum depth allowed when reading JSON. Reading past this depth will throw a JsonReaderException.
Public propertyMetadataPropertyHandling
Gets or sets how metadata properties are used during deserialization.
Public propertyMissingMemberHandling
Get or set how missing members (e.g. JSON contains a property that isn't a member on the object) are handled during deserialization.
Public propertyNullValueHandling
Get or set how null values are handled during serialization and deserialization.
Public propertyObjectCreationHandling
Gets or sets how objects are created during deserialization.
Public propertyPreserveReferencesHandling
Gets or sets how object references are preserved by the serializer.
Public propertyReferenceLoopHandling
Get or set how reference loops (e.g. a class referencing itself) is handled.
Public propertyReferenceResolver
Gets or sets the IReferenceResolver used by the serializer when resolving references.
Public propertyStringEscapeHandling
Get or set how strings are escaped when writing JSON text.
Public propertyTraceWriter
Gets or sets the ITraceWriter used by the serializer when writing trace messages.
Public propertyTypeNameAssemblyFormat
Gets or sets how a type name assembly is written and resolved by the serializer.
Public propertyTypeNameHandling
Gets or sets how type name writing and reading is handled by the serializer.
Top
Events
  NameDescription
Public eventError
Occurs when the JsonSerializer errors during serialization and deserialization.
Top
See Also