AwkwardCoder
AwkwardCoder

Reputation: 25631

Can I pass a JSON object from Silverlight to javascript

I know I can call javascript and pass string values from Silverlight, but can I pass a JSON object or does it have to be serialized?

Upvotes: 1

Views: 1073

Answers (2)

AwkwardCoder
AwkwardCoder

Reputation: 25631

The full answer to this question can be found at:

Silverlight passing JSON object incorrectly?

Upvotes: 0

Andy E
Andy E

Reputation: 344585

If you make the object have [ScriptableType] and pass it in your arguments, you can achieve what you're trying to do without encoding the object to JSON and decoding on the JS side:

See the heading Return Objects From Silverlight Method Calls To JavaScript at http://pietschsoft.com/post/2008/06/19/Silverlight-and-JavaScript-Interop-Basics.aspx

Upvotes: 1

Related Questions