JSON and Silverlight 2
I was crufting up a sample LINQ to JSON example today to post in my blog but something odd happened. I couldn’t find a public service that both used JSON and supports a security policy file. Let me clarify that.
In Silverlight (like Flash/Flex), in order to make calls to external domains, that domain must support a security policy file. Flash defines one format and Silverlight another, though Silverlight supports the Flash format (for the most part). So if a domain has allowed Flash to access its site, Silverlight should be able to. Great…right?
I could have crafted up an example of writing your own service that exposed JSON (pretty easy in .NET 3.5 and WCF), but that’s not the point. If I was going to expose a service, why would I choose JSON if Silverlight is the only client? Its not significantly smaller than XML and the other benefits are not significant enough to bother.
What I thought was a no brainer was to use one of the public API’s that support it (e.g. Yahoo Image Search, Google Base, etc.) So far none that I can find support a policy file (Flash’s or Silverlight’s) so I can’t call them. This is similar to the problem with Amazon’s S3 lack of policy file support noted by several people (Tim Heuer most notably).
I’d love to finish the example and show it because LINQ to SQL is cool, but until I find a compelling public API, I won’t bother…its just not that important. If any of my readers know of one (or think one might work), let me know and I’ll try it out.