-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
@@ -53,8 +53,8 @@ namespace Newtonsoft.Json.Tests.Serialization
Assert.AreEqual(@"{
""name"": ""Name!"",
""birthDate"": ""\/Date(974764544000)\/"",
""lastModified"": ""\/Date(974764544000)\/""
""birthDate"": ""2000-11-20T23:55:44Z"",
""lastModified"": ""2000-11-20T23:55:44Z""
}", json);
Person deserializedPerson = JsonConvert.DeserializeObject<Person>(json, new JsonSerializerSettings
@@ -69,8 +69,8 @@ namespace Newtonsoft.Json.Tests.Serialization
json = JsonConvert.SerializeObject(person, Formatting.Indented);
Assert.AreEqual(@"{
""Name"": ""Name!"",
""BirthDate"": ""\/Date(974764544000)\/"",
""LastModified"": ""\/Date(974764544000)\/""
""BirthDate"": ""2000-11-20T23:55:44Z"",
""LastModified"": ""2000-11-20T23:55:44Z""
}", json);
}
@@ -160,7 +160,7 @@ namespace Newtonsoft.Json.Tests.Serialization
Assert.AreEqual(@"{
""name"": ""Widget"",
""expiryDate"": ""\/Date(1292868060000)\/"",
""expiryDate"": ""2010-12-20T18:01:00Z"",
""price"": 9.99,
""sizes"": [
""Small"",