Class JsonExtensions

Controller extensions for json serialization using JsonDataResult.

Inheritance
System.Object
JsonExtensions
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: EPiServer.Shell.Web.Mvc
Assembly: EPiServer.Shell.dll
Version: 8.11.0
Syntax
public static class JsonExtensions

Methods

JsonData(Controller, Object)

Returns a JsonDataResult for converting the data object to its json representation.

Declaration
public static JsonDataResult JsonData(this Controller controller, object data)
Parameters
Type Name Description
System.Web.Mvc.Controller controller

The controller context.

System.Object data

The object to convert to json.

Returns
Type Description
JsonDataResult

A JsonDataResult containing the data that can be used to execute the results of the controller.

JsonData(Controller, Object, JsonRequestBehavior)

Returns a JsonDataResult for converting the data object to its json representation.

Declaration
public static JsonDataResult JsonData(this Controller controller, object data, JsonRequestBehavior behavior)
Parameters
Type Name Description
System.Web.Mvc.Controller controller

The controller context.

System.Object data

The object to convert to json.

System.Web.Mvc.JsonRequestBehavior behavior

Any specific behavior for the json serialization.

Returns
Type Description
JsonDataResult

A JsonDataResult containing the data that can be used to execute the results of the controller.

JsonData(Controller, Object, JsonRequestBehavior, IObjectSerializerFactory)

Returns a JsonDataResult for converting the data object to its json representation.

Declaration
public static JsonDataResult JsonData(this Controller controller, object data, JsonRequestBehavior behavior, IObjectSerializerFactory serializerFactory)
Parameters
Type Name Description
System.Web.Mvc.Controller controller

The controller context.

System.Object data

The object to convert to json.

System.Web.Mvc.JsonRequestBehavior behavior

Any specific behavior for the json serialization.

IObjectSerializerFactory serializerFactory

The serializer factory used to get the appropriate serializer.

Returns
Type Description
JsonDataResult

A JsonDataResult containing the data that can be used to execute the results of the controller.

WrappedJsonData(Controller, Object)

Returns a WrappedJsonDataResults for converting the data object to its json representation and wrapping it in a textarea tag.

Declaration
public static WrappedJsonDataResults WrappedJsonData(this Controller controller, object data)
Parameters
Type Name Description
System.Web.Mvc.Controller controller

The controller context.

System.Object data

The object to convert to json.

Returns
Type Description
WrappedJsonDataResults