I am trying to get a string representation of my JSON object back to my C# application, but every time I use JSON.stringify(jsonObj)
, it returns null
to my application. I am using a WebBrowser
control.
Page is set up like this:
var myObj = { "foo": [] }
// Push data into it
function getMyObj() {
return JSON.stringify(myObj);
}
In my C# code I have this:
string bar = myWebBrowser.MainBrowser.Document.InvokeScript("getMyObj").ToString();
However, after invoking the method, it returns null
. I even tried putting an alert
in the JavaScript page where I call the getMyObj()
function inside the alert
, but the alert never comes up.
Is it a WebBrowser
control issue? JSON should be supported, the browser is using IE11.