JsonHelperExtensions.Serialize Method

Definition

Returns serialized JSON for the value.

C#
public static Microsoft.AspNetCore.Html.IHtmlContent Serialize (this Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper jsonHelper, object value, Newtonsoft.Json.JsonSerializerSettings serializerSettings);

Parameters

jsonHelper
IJsonHelper

The IJsonHelper.

value
Object

The value to serialize as JSON.

serializerSettings
Newtonsoft.Json.JsonSerializerSettings

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

Returns

A new IHtmlContent containing the serialized JSON.

Remarks

The value for Newtonsoft.Json.JsonSerializerSettings.StringEscapeHandling from serializerSettings is ignored by this method and Newtonsoft.Json.StringEscapeHandling.EscapeHtml is always used.

Applies to

Tuote Versiot
ASP.NET Core 3.0, 3.1, 5.0, 6.0, 7.0, 8.0, 9.0