I have a site built with ASP.NET MVC. I have a string in my view model that looks like this:
ViewBag.Text = "{\"1\":{\"1\":\"John\",\"2\":\"Bill\",\"3\":\"Paul\"},\"3\":{}}";
I want to output this into my view like this:
<input id='myHiddenInput' type='hidden' value='@ViewBag.Text' />
When the view gets rendered, the hidden element looks like this:
<input id='myHiddenInput' type='hidden' value='{"1":{"1":"John","2":"Bill","3":"Paul"},"3":{}}' />
How do I update the view so that the output looks like the following:
<input id='myHiddenInput' type='hidden' value='{"1":{"1":"John";,"2":"Bill","3":"Paul"},"3":{}}' />
I know this seems goofy. This really is what i need to do though.