ViewData tablica MVC Razor JavaScript

// For ASP.NET  
var monthLists = @Html.Raw(Json.Encode(ViewData["months"]));

// For ASP.NET CORE
var monthLists = @Html.Raw(Json.Serialize(ViewData["months"]));
Cheerful Crocodile