Controller.Json Controller.Json Controller.Json Method

Definition

Overloads

Json(Object) Json(Object) Json(Object)

Creates a JsonResult object that serializes the specified data object to JSON.

Json(Object, JsonSerializerSettings) Json(Object, JsonSerializerSettings) Json(Object, JsonSerializerSettings)

Creates a JsonResult object that serializes the specified data object to JSON.

Json(Object) Json(Object) Json(Object)

Creates a JsonResult object that serializes the specified data object to JSON.

[Microsoft.AspNetCore.Mvc.NonAction]
public virtual Microsoft.AspNetCore.Mvc.JsonResult Json (object data);
abstract member Json : obj -> Microsoft.AspNetCore.Mvc.JsonResult
override this.Json : obj -> Microsoft.AspNetCore.Mvc.JsonResult
Public Overridable Function Json (data As Object) As JsonResult

Parameters

data
Object Object Object

The object to serialize.

Returns

The created JsonResult that serializes the specified data to JSON format for the response.

Json(Object, JsonSerializerSettings) Json(Object, JsonSerializerSettings) Json(Object, JsonSerializerSettings)

Creates a JsonResult object that serializes the specified data object to JSON.

[Microsoft.AspNetCore.Mvc.NonAction]
public virtual Microsoft.AspNetCore.Mvc.JsonResult Json (object data, Newtonsoft.Json.JsonSerializerSettings serializerSettings);
abstract member Json : obj * Newtonsoft.Json.JsonSerializerSettings -> Microsoft.AspNetCore.Mvc.JsonResult
override this.Json : obj * Newtonsoft.Json.JsonSerializerSettings -> Microsoft.AspNetCore.Mvc.JsonResult
Public Overridable Function Json (data As Object, serializerSettings As JsonSerializerSettings) As JsonResult

Parameters

data
Object Object Object

The object to serialize.

serializerSettings
Newtonsoft.Json.JsonSerializerSettings Newtonsoft.Json.JsonSerializerSettings Newtonsoft.Json.JsonSerializerSettings

The Newtonsoft.Json.JsonSerializerSettings to be used by the formatter.

Returns

The created JsonResult that serializes the specified data as JSON format for the response.

Remarks

Callers should cache an instance of Newtonsoft.Json.JsonSerializerSettings to avoid recreating cached data with each call.

Applies to