-Added DateFormatHandling to control whether dates are written in the MS format or ISO format, with ISO as the default

-Added DateTimeZoneHandling to control reading and writing DateTime time zone details
-Added reader/writer specific Formatting, DateFormatHandling and DateTimeZoneHandling to JsonSerializerSettings
-Added feature of reader/writer specific settings to be set on JsonReader/JsonWriter when serializing
-Added ReadAsDate to JsonReader
-Added ReadAsString to JsonReader
-Changed JsonTextReader to automatically read ISO strings as dates
-Refactored ReadAsXXX methods and reduce code redundancy
-Removed unused JsonDateTimeSerializationMode
This commit is contained in:
James Newton-King
2012-03-04 18:10:20 +06:00
parent fb2a5998bc
commit fd760e3389
43 changed files with 1728 additions and 826 deletions
@@ -170,7 +170,7 @@ namespace Newtonsoft.Json.Tests.Converters
]
}";
DataSet ds = JsonConvert.DeserializeObject<DataSet>(json, new IsoDateTimeConverter());
DataSet ds = JsonConvert.DeserializeObject<DataSet>(json);
Assert.IsNotNull(ds);
Assert.AreEqual(2, ds.Tables.Count);
@@ -187,7 +187,7 @@ namespace Newtonsoft.Json.Tests.Converters
Assert.AreEqual("TimeSpanCol", dt.Columns[3].ColumnName);
Assert.AreEqual(typeof(string), dt.Columns[3].DataType);
Assert.AreEqual("DateTimeCol", dt.Columns[4].ColumnName);
Assert.AreEqual(typeof(string), dt.Columns[4].DataType);
Assert.AreEqual(typeof(DateTime), dt.Columns[4].DataType);
Assert.AreEqual("DecimalCol", dt.Columns[5].ColumnName);
Assert.AreEqual(typeof(double), dt.Columns[5].DataType);
@@ -270,7 +270,7 @@ namespace Newtonsoft.Json.Tests.Converters
""int32Col"": 1,
""booleanCol"": true,
""timeSpanCol"": ""10.22:10:15.1000000"",
""dateTimeCol"": ""\/Date(978048000000)\/"",
""dateTimeCol"": ""2000-12-29T00:00:00Z"",
""decimalCol"": 64.0021
},
{
@@ -278,7 +278,7 @@ namespace Newtonsoft.Json.Tests.Converters
""int32Col"": 2,
""booleanCol"": true,
""timeSpanCol"": ""10.22:10:15.1000000"",
""dateTimeCol"": ""\/Date(978048000000)\/"",
""dateTimeCol"": ""2000-12-29T00:00:00Z"",
""decimalCol"": 64.0021
}
],
@@ -288,7 +288,7 @@ namespace Newtonsoft.Json.Tests.Converters
""int32Col"": 1,
""booleanCol"": true,
""timeSpanCol"": ""10.22:10:15.1000000"",
""dateTimeCol"": ""\/Date(978048000000)\/"",
""dateTimeCol"": ""2000-12-29T00:00:00Z"",
""decimalCol"": 64.0021
}
]