@using Microsoft.AspNetCore.Mvc.Formatters
@using Newtonsoft.Json
@using Newtonsoft.Json.Serialization
@{
    var settings = JsonSerializerSettingsProvider.CreateSerializerSettings();
    settings.ContractResolver = new DefaultContractResolver
    {
        NamingStrategy = (NamingStrategy)(ViewData["naming"]),
    };
}
<script type="text/javascript">
    var json = @Json.Serialize(Model, settings);
</script>