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 in my application. I am using a WebBrowser .
The page is configured as follows:
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 calling the method, it returns null . I even tried setting alert on a JavaScript page where I call the getMyObj() function inside alert , but the warning never appears.
Is this a webbrowser management issue? JSON must be supported, the browser uses IE11.
cress source share