I use a WebBrowser object from WPF and I\'m calling some Javascript code in the page loaded in the browser like this:
myWebBrowser.InvokeScript(\"myJsFunc\", new
Maybe pass it as a json string instead and parse it in the js function
var serializer = new System.Web.Script.Serialization.JavaScriptSerializer();
var json = serializer.Serialize(bar.ToArray());
myWebBrowser.InvokeScript("myJsFunc", new object[] { foo.Text, json });
js:
function myJsFunc(json) {
var data = JSON.parse(json);
// do something with it.
}
http://blogs.microsoft.co.il/blogs/pini_dayan/archive/2009/03/12/convert-objects-to-json-in-c-using-javascriptserializer.aspx