I have been using something like this inside Razor
@section Includes {
<script type="text/javascript">
var somestuffneeded = @(Html.Raw(Json.Encode(Model.datamember)));
</script>
}
But this looks not so clean because it goes in the same file as the layout, (since it won't work from the .js file directly). Any clean alternatives to accessing and viewing the ViewModel passed inside .js file?