[Mono-dev] Proposed Extension to System.Web.Script.Serialization

R. Tyler Ballance tyler at monkeypox.org
Sun Sep 2 22:44:56 EDT 2007


Firstly, I'm so glad we have System.Web.Script.Serialization now, woot!

The one major thing missing from JSON serialization (contrasted to  
XML serialization) is the ability to tell the serializer how to  
serialize out your object's attributes, in terms of names. I asked  
James Newton-King about this for Json.NET and he forwarded me a  
modified version of Json.NET that allowed such a beast and I've  
ported it over to our System.Web.Script.Serialization, the only thing  
holding me from committing it is:
	a) Permission from Igor and Konstantin
	b) The fact that .NET doesn't actually define something like this in  
their API

Executing my little test application (attached: JsonTest.cs), my  
"Message" property is serialized out under a different name (insanely  
helpful when dealing with existing JSON APIs and code)


> [mono] \w @ mono JsonTest.exe
> Serializing TestClass out as: {"my_magic_message":"magic!"}


Attached is the cumulative patch for mcs/class/System.Web.Extensions/ 
System.Web.Script.Serialization, I'd like some review and permission  
to go ahead and commit it :D

(patch diffed against rev 85204)

Cheers,
-R. Tyler Ballance

-------------- next part --------------
A non-text attachment was scrubbed...
Name: JsonTest.cs
Type: application/octet-stream
Size: 994 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20070902/2359f553/attachment.obj 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ScriptElementAttribute.patch
Type: application/octet-stream
Size: 9837 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20070902/2359f553/attachment-0001.obj 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 186 bytes
Desc: This is a digitally signed message part
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20070902/2359f553/attachment.bin 


More information about the Mono-devel-list mailing list