Integrating JSON with WPF/E

I've been playing a lot with creating dynamic XAML lately and while I'm a big fan of XML it can definitely get in the way when large chunks of a WPF/E document need to be added. Since WPF/E integrates nicely with JavaScript and ASP.NET AJAX can be used, is there any chance that you're considering adding a CreateFromJson() type method so that we could feed dynamic JSON objects representing the XAML objects to the control instead of XML strings?

A perfect scenario is calling Web Services with ASP.NET AJAX and adding the XAML returned to a canvas. If calls are returned as JSON rather than XML, the message payload is minimized substantially and it's a lot easier and more concise to work with in many cases. It would be a nice tie-in to ASP.NET AJAX IMHO although I realize it adds serialization/deserialization requirements...and that XML is a big part of WPF in general.

[894 byte] By [DanWahlin] at [2008-2-25]
# 1
Thanks for your feedback. It was forwarded to the produc team to consider.
BarakCohen at 2007-9-4 > top of Msdn Tech,Silverlight (formerly WPF/E),Silverlight (formerly WPF/E) Developer Issues...
# 2

Hi Dan,

if you are using ASP.NET AJAX or AjaxPro you can return a string which contains an XML, so this is easy to do today. I don't see any reason to add a JSON format for the XAML code, but if you want it is very easy to write your own code for this. I did a C# implementation of the WPF/E elements and created such classes. Returning these with AjaxPro lets you get the JSON data. On the client I was using a common JSON to XML converter, and I had my XAML code... ;)

So, I'm not sure if this would be a big benefit when implemented in the plug-in which should be optimized to minimal size.

Michael

MichaelSchwarz-MVP at 2007-9-4 > top of Msdn Tech,Silverlight (formerly WPF/E),Silverlight (formerly WPF/E) Developer Issues...
# 3
Right...I'm doing that now. However, the XAML can be fairly large and cumbersome to work with whereas JSON is much smaller over the wire. I don't think my feature request will ever get added, but it would be a nice feature to have to keep message sizes smaller (by orders of magnitude) and ties in nicely to ASP.NET AJAX Web Service calls.
DanWahlin at 2007-9-4 > top of Msdn Tech,Silverlight (formerly WPF/E),Silverlight (formerly WPF/E) Developer Issues...
# 4

Dan,

I had a look on a very large XAML document and created a ZIP of it what could be compared with the GZIP IIS feature for static files. I'm not sure if there is a big difference to a JSON format. A lot of the properties are set as attributes, and this will not be smaller when using JSON data format. So, I think Microsoft should concentrate more on features, plug-in bugs and maybe support in the Expression suite.

Michael

MichaelSchwarz-MVP at 2007-9-4 > top of Msdn Tech,Silverlight (formerly WPF/E),Silverlight (formerly WPF/E) Developer Issues...
# 5
I agree....I'd highly prefer they work on existing bugs and adding new features.
DanWahlin at 2007-9-4 > top of Msdn Tech,Silverlight (formerly WPF/E),Silverlight (formerly WPF/E) Developer Issues...