Export (0) Print
Expand All

JsonMediaTypeFormatter Class

Represents the MediaTypeFormatter class to handle JSON.

System.Object
  System.Net.Http.Formatting.MediaTypeFormatter
    System.Net.Http.Formatting.JsonMediaTypeFormatter

Namespace:  System.Net.Http.Formatting
Assembly:  System.Net.Http.Formatting (in System.Net.Http.Formatting.dll)

'Declaration
Public Class JsonMediaTypeFormatter _
	Inherits MediaTypeFormatter
'Usage
Dim instance As JsonMediaTypeFormatter

The JsonMediaTypeFormatter type exposes the following members.

  NameDescription
Public methodJsonMediaTypeFormatter Initializes a new instance of the JsonMediaTypeFormatter class.
Top

  NameDescription
Public propertyStatic memberDefaultMediaTypeGets the default media type for JSON, namely "application/json".
Public propertyIndent Gets or sets a value indicating whether to indent elements when writing data.
Public propertyMaxDepthGets or sets the maximum depth allowed by this formatter.
Public propertyMediaTypeMappingsGets the mutable collection of MediaTypeMapping objects that match HTTP requests to media types. (Inherited from MediaTypeFormatter.)
Public propertyRequiredMemberSelectorGets or sets the IRequiredMemberSelector instance used to determine required members. (Inherited from MediaTypeFormatter.)
Public propertySerializerSettings Gets or sets the JsonSerializerSettings used to configure the JsonSerializer.
Public propertySupportedEncodingsGets the mutable collection of character encodings supported bythis MediaTypeFormatter. (Inherited from MediaTypeFormatter.)
Public propertySupportedMediaTypesGets the mutable collection of media types supported bythis MediaTypeFormatter. (Inherited from MediaTypeFormatter.)
Public propertyUseDataContractJsonSerializer Gets or sets a value indicating whether to use DataContractJsonSerializer by default.
Top

  NameDescription
Public methodCanReadTypeDetermines whether this JsonMediaTypeFormatter can read objects of the specified type. (Overrides MediaTypeFormatter.CanReadType(Type).)
Public methodCanWriteTypeDetermines whether this JsonMediaTypeFormatter can write objects of the specified type. (Overrides MediaTypeFormatter.CanWriteType(Type).)
Public methodCreateDefaultSerializerSettings Creates a JsonSerializerSettings instance with the default settings used by the JsonMediaTypeFormatter.
Public methodEquals (Inherited from Object.)
Protected methodFinalize (Inherited from Object.)
Public methodGetHashCode (Inherited from Object.)
Public methodGetPerRequestFormatterInstanceReturns a specialized instance of the MediaTypeFormatter that can format a response for the given parameters. (Inherited from MediaTypeFormatter.)
Public methodGetType (Inherited from Object.)
Protected methodMemberwiseClone (Inherited from Object.)
Public methodReadFromStreamAsyncReads an object of the specified type from the specified stream. This method is called during deserialization. (Overrides MediaTypeFormatter.ReadFromStreamAsync(Type, Stream, HttpContent, IFormatterLogger).)
Public methodSelectCharacterEncodingDetermines the best character encoding for reading or writing an HTTP entity body, given a set of content headers. (Inherited from MediaTypeFormatter.)
Public methodSetDefaultContentHeaders Sets the default headers for content that will be formatted using this formatter. This method is called from the ObjectContent constructor. This implementation sets the Content-Type header to the value of mediaType if it is not null. If it is null it sets the Content-Type to the default media type of this formatter. If the Content-Type does not specify a charset it will set it using this formatters configured Encoding. (Inherited from MediaTypeFormatter.)
Public methodToString (Inherited from Object.)
Public methodWriteToStreamAsyncWrites an object of the specified type to the specified stream. This method is called during serialization. (Overrides MediaTypeFormatter.WriteToStreamAsync(Type, Object, Stream, HttpContent, TransportContext).)
Top

  NameDescription
Public Extension MethodAddQueryStringMapping(String, String, MediaTypeHeaderValue)Overloaded. Updates the given set of formatter of MediaTypeMapping elements so that it associates the mediaType with Uris containing a specific query parameter and value. (Defined by MediaTypeFormatterExtensions.)
Public Extension MethodAddQueryStringMapping(String, String, String)Overloaded. Updates the given set of formatter of MediaTypeMapping elements so that it associates the mediaType with Uris containing a specific query parameter and value. (Defined by MediaTypeFormatterExtensions.)
Public Extension MethodAddRequestHeaderMapping(String, String, StringComparison, Boolean, MediaTypeHeaderValue)Overloaded. Updates the given set of formatter of MediaTypeMapping elements so that it associates the mediaType with a specific HTTP request header field with a specific value. (Defined by MediaTypeFormatterExtensions.)
Public Extension MethodAddRequestHeaderMapping(String, String, StringComparison, Boolean, String)Overloaded. Updates the given set of formatter of MediaTypeMapping elements so that it associates the mediaType with a specific HTTP request header field with a specific value. (Defined by MediaTypeFormatterExtensions.)
Public Extension MethodAddUriPathExtensionMapping(String, MediaTypeHeaderValue)Overloaded. Updates the given formatter's set of MediaTypeMapping elements so that it associates the mediaType with Uris ending with the given uriPathExtension. (Defined by MediaTypeFormatterExtensions.)
Public Extension MethodAddUriPathExtensionMapping(String, String)Overloaded. Updates the given formatter's set of MediaTypeMapping elements so that it associates the mediaType with Uris ending with the given uriPathExtension. (Defined by MediaTypeFormatterExtensions.)
Top

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show:
© 2014 Microsoft