CURRENT PROJECTS
loading
DateTime currDate = new DateTime(); Hashtable dateTest = new Hashtable(); dateTest.Add(currDate, "random value");to be able to serialize as (with the default DateTime format):
{"4/24/2008 12:00:00 AM":"random Value"}
--- JsonMapper.cs 24 Apr 2008 23:16:16 -0000 1.1
+++ JsonMapper.cs 24 Apr 2008 23:16:54 -0000
@@ -739,7 +739,11 @@
if (obj is IDictionary) {
writer.WriteObjectStart ();
foreach (DictionaryEntry entry in (IDictionary) obj) {
- writer.WritePropertyName ((string) entry.Key);
+ if (entry.Key is DateTime)
+ writer.WritePropertyName ( entry.Key.ToString() );
+ else
+ writer.WritePropertyName ((string) entry.Key);
+
WriteValue (entry.Value, writer, writer_is_private,
depth + 1);
}
Download patch: JsonMapper.cs.qwnu.diff

