Pass empty model to razor view
i needed to pass empty instance for a model i have to my razor view so Vue (as my client side) can use it, as i was avoiding re-type the whole model again. usually when you pass you model with values in ViewBag if you use @Html.Raw(ViewBag.ModelClass) Copy to Clipboard you get Json, but to my surprise that is not the case if it's just an empty no values instance, in that case this code will return the object name! to solve this i added Json.Serialize to the mix, so @Html.Raw(Json.Serialize(ViewBag.ModelClass)) Copy to Clipboard will return an empty value json representing the model empty instance.