|
Rank: Newbie Groups: Member
Joined: 4/28/2019 Posts: 5
|
Hello, Is there an easy way to serialize the data in a JSObject? For example:
Code: C#
EO.WebBrowser.JSObject vals = (EO.WebBrowser.JSObject)webView1.EvalScript("jsobject_with_lots_of_data");
var json = new JavaScriptSerializer().Serialize(vals);
Debug.WriteLine(json);
How can I get something like this to work so that I can parse through the data quickly? Thanks!
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,218
|
Hi, There is no way for you to reliably serialize a JSObject on the .NET side. JSObject does not hold the data itself. Instead it holds a "handle" to the actual object in the JavaScript "world". In a way similar to .NET's MarshalByRefObject. Such as by definition it is not serializable. If you wish to pass complex data in between JavaScript and .NET, you should serialize it on the JavaScript side: https://www.essentialobjects.com/doc/webbrowser/advanced/json.aspxThanks!
|
|
Rank: Newbie Groups: Member
Joined: 4/28/2019 Posts: 5
|
Thank you! Can't believe I missed this.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,218
|
You are welcome. Please feel free to let us know if there is anything else.
|
|