I am trying to convert a model object to a json object. I tried doing this
<script type="text/javascript">
var myobj = '@Html.Raw(Json.Serialize(Model.MyObject))';
</script>
However the above myobjis string. I tried converting it to an object using this
var myobj = JSON.parse(myobj)
However the above gives a parsing error.
My question is what is the fastest way to convert Model.MyObject to a json object.