George Kierstein
Posts: 47
Joined: 2013-05-04
|
Hi,
I'm returning JSON data from a script in a page and I can't see how to unpack the data. The InvokeMember method gets back a valid object but its a general COM class that doesn't have an obvious way to figure out what the data coming back from the script looks like or how to get it. There isn't anything that I could find in the documentation that makes this clear either.
My questions are: how in general do I figure out what types/kinds of data are passed back by InvokeMember, how do I get at them and specifically when I am passing back a JSON value what is its type and how do I get it into a form I can deserialize ?
Thanks
G |
|
Andrei Smolin
Add-in Express team
Posts: 18719
Joined: 2006-05-11
|
Hello George,
You can use Microsoft.VisualBasic.Information.TypeName(obj) to get the type name behind that COM object. You'll need to add a reference to Microsoft.VisualBasic.
Andrei Smolin
Add-in Express Team Leader |
|
George Kierstein
Posts: 47
Joined: 2013-05-04
|
Sorry, this is all in C# - Or is what you are referring to C# ?
Could you please provide a simple example of getting back a string please ?
Thanks! |
|
Andrei Smolin
Add-in Express team
Posts: 18719
Joined: 2006-05-11
|
This syntax is valid in C# and VB.NET:
System.Diagnostics.Debug.WriteLine(Microsoft.VisualBasic.Information.TypeName(obj)).
For this code to compile and execute, the project needs to have a reference to Microsoft.VisualBasic.DLL. To get the output of the Debug.WriteLine() method, you can use the DebugView utility; IE should be run either via "Run as administrator" or with Protection Mode turned off; the add-on must be built in the Debug configuration.
Andrei Smolin
Add-in Express Team Leader |
|