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);
abstract member Json : obj * string * System.Text.Encoding * System.Web.Mvc.JsonRequestBehavior -> System.Web.Mvc.JsonResult
override this.Json : obj * string * System.Text.Encoding * System.Web.Mvc.JsonRequestBehavior -> System.Web.Mvc.JsonResult
Protected Friend Overridable Function Json (data As Object, contentType As String, contentEncoding As Encoding, behavior As JsonRequestBehavior) As JsonResult

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);
member this.Json : obj * string * System.Web.Mvc.JsonRequestBehavior -> System.Web.Mvc.JsonResult
Protected Friend Function Json (data As Object, contentType As String, behavior As JsonRequestBehavior) As JsonResult

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);
abstract member Json : obj * string * System.Text.Encoding -> System.Web.Mvc.JsonResult
override this.Json : obj * string * System.Text.Encoding -> System.Web.Mvc.JsonResult
Protected Friend Overridable Function Json (data As Object, contentType As String, contentEncoding As Encoding) As JsonResult

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);
member this.Json : obj -> System.Web.Mvc.JsonResult
Protected Friend Function Json (data As Object) As JsonResult

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);
member this.Json : obj * string -> System.Web.Mvc.JsonResult
Protected Friend Function Json (data As Object, contentType As String) As JsonResult

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);
member this.Json : obj * System.Web.Mvc.JsonRequestBehavior -> System.Web.Mvc.JsonResult
Protected Friend Function Json (data As Object, behavior As JsonRequestBehavior) As JsonResult

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