Controller.Json Method

Definition

Overloads

Json(Object, String, Encoding, JsonRequestBehavior)

Creates a JsonResult object that serializes the specified object to JavaScript Object Notation (JSON) format using the content type, content encoding, and the JSON request behavior.

Json(Object, String, JsonRequestBehavior)

Creates a JsonResult object that serializes the specified object to JavaScript Object Notation (JSON) format using the specified content type and JSON request behavior.

Json(Object, String, Encoding)

Creates a JsonResult object that serializes the specified object to JavaScript Object Notation (JSON) format.

Json(Object)

Creates a JsonResult object that serializes the specified object to JavaScript Object Notation (JSON).

Json(Object, String)

Creates a JsonResult object that serializes the specified object to JavaScript Object Notation (JSON) format.

Json(Object, JsonRequestBehavior)

Creates a JsonResult object that serializes the specified object to JavaScript Object Notation (JSON) format using the specified JSON request behavior.

Json(Object, String, Encoding, JsonRequestBehavior)

Creates a JsonResult object that serializes the specified object to JavaScript Object Notation (JSON) format using the content type, content encoding, and the JSON request behavior.

protected internal virtual System.Web.Mvc.JsonResult Json(object data, string contentType, System.Text.Encoding contentEncoding, System.Web.Mvc.JsonRequestBehavior behavior);

Parameters

data
Object

The JavaScript object graph to serialize.

contentType
String

The content type (MIME type).

contentEncoding
Encoding

The content encoding.

behavior
JsonRequestBehavior

The JSON request behavior

Returns

The result object that serializes the specified object to JSON format.

Applies to

Json(Object, String, JsonRequestBehavior)

Creates a JsonResult object that serializes the specified object to JavaScript Object Notation (JSON) format using the specified content type and JSON request behavior.

protected internal System.Web.Mvc.JsonResult Json(object data, string contentType, System.Web.Mvc.JsonRequestBehavior behavior);

Parameters

data
Object

The JavaScript object graph to serialize.

contentType
String

The content type (MIME type).

behavior
JsonRequestBehavior

The JSON request behavior

Returns

The result object that serializes the specified object to JSON format.

Applies to

Json(Object, String, Encoding)

Creates a JsonResult object that serializes the specified object to JavaScript Object Notation (JSON) format.

protected internal virtual System.Web.Mvc.JsonResult Json(object data, string contentType, System.Text.Encoding contentEncoding);

Parameters

data
Object

The JavaScript object graph to serialize.

contentType
String

The content type (MIME type).

contentEncoding
Encoding

The content encoding.

Returns

The JSON result object that serializes the specified object to JSON format.

Applies to

Json(Object)

Creates a JsonResult object that serializes the specified object to JavaScript Object Notation (JSON).

protected internal System.Web.Mvc.JsonResult Json(object data);

Parameters

data
Object

The JavaScript object graph to serialize.

Returns

The JSON result object that serializes the specified object to JSON format. The result object that is prepared by this method is written to the response by the ASP.NET MVC framework when the object is executed.

Applies to

Json(Object, String)

Creates a JsonResult object that serializes the specified object to JavaScript Object Notation (JSON) format.

protected internal System.Web.Mvc.JsonResult Json(object data, string contentType);

Parameters

data
Object

The JavaScript object graph to serialize.

contentType
String

The content type (MIME type).

Returns

The JSON result object that serializes the specified object to JSON format.

Applies to

Json(Object, JsonRequestBehavior)

Creates a JsonResult object that serializes the specified object to JavaScript Object Notation (JSON) format using the specified JSON request behavior.

protected internal System.Web.Mvc.JsonResult Json(object data, System.Web.Mvc.JsonRequestBehavior behavior);

Parameters

data
Object

The JavaScript object graph to serialize.

behavior
JsonRequestBehavior

The JSON request behavior.

Returns

The result object that serializes the specified object to JSON format.

Applies to