This documentation is archived and is not being maintained.

JsonQueryStringConverter Class

This class converts a parameter value to and from a JavaScript Object Notation (JSON).


Namespace:  System.ServiceModel.Dispatcher
Assembly:  System.ServiceModel.Web (in System.ServiceModel.Web.dll)

public class JsonQueryStringConverter : QueryStringConverter

The JsonQueryStringConverter type exposes the following members.

Public methodJsonQueryStringConverterInitializes a new instance of the JsonQueryStringConverter class.

Public methodCanConvertGets a value that indicates whether a Common Language Runtime (CLR) type specified is a known type that can be serialized and deserialized. (Overrides QueryStringConverter.CanConvert(Type).)
Public methodConvertStringToValueDeserializes a JavaScript Object Notation (JSON) query string parameter to a specified Common Language Runtime (CLR) type. (Overrides QueryStringConverter.ConvertStringToValue(String, Type).)
Public methodConvertValueToStringSerializes a Common Language Runtime (CLR) parameter type to a JavaScript Object Notation (JSON) representation. (Overrides QueryStringConverter.ConvertValueToString(Object, Type).)
Public methodEquals(Object)Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)

Parameters can be specified in a JSON query string within a URL. This class controls how JSON query string parameters are mapped to and from a service operation's parameters when the WebScriptEnablingBehavior is used to process HTTP requests from browser-based ASP.NET AJAX clients.

This class is used internally by the WebScriptEnablingBehavior class for endpoints configured to accept HTTP GET/POST requests with parameters encoded in the URI query string. This class is used to convert between CLR objects and the individual operation request parameter values in the URI query string. Unlike its base type, this class supports values of both primitive and complex types.

JsonQueryStringConverter derives from QueryStringConverter and supports the following types:

Unlike its base type, this converter can handle any type adhering to the Data Contract model. The converter overrides ConvertValueToString(Object, Type) so that each parameter is serialized to JSON using the default DataContractJsonSerializer and a JSON XML Writer configured to use the UTF-8 encoding. null parameters are returned as null.

.NET Framework

Supported in: 4, 3.5

.NET Framework Client Profile

Supported in: 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

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