I'm passing a JSON object to Javascript via the ViewBag with the following code in my view:
var jsonResultData = @Html.Raw(ViewBag.JsonResultData);
This approach works fine but VisualStudio keeps giving me a 'Conditional compilation is turned off' warning. It seems VS wants quotes around @Html.Raw(ViewBag.JsonResultData); If I add quotes jQuery sees the variable as a string rather than JSON data.
Is my approach flawed? Is there another way I should be approaching this? If not can I disable the VS warning? An annoying side effect of the warning is I can't format my code using CTRL K-D.