Razor can get finicky when you are mixing it into JS code so I have a helper that looks like
Ajax.JsonData(string varName, object blob)
That will take care of doing json serialization and generate a js object for me. I do this so that I don't have to mess with something like
To work around this I create a thing_sample.js file right next to the view I'm working on and then use my helper like this:
/// <reference path="thing_sample.js" /> @Ajax.JsonData("thing",Model.Things)
and inside my sample file
var thing = [ ... some sample data ... ];
Now visual studio will think my variable exists and be able to give me intellisense on the json.