Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/Newtonsoft.Json.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Newton-King <james@newtonking.com>2012-03-19 16:08:30 +0400
committerJames Newton-King <james@newtonking.com>2012-03-19 16:08:30 +0400
commitd988312c37692e7cdd626b1a38ce7607e18423cb (patch)
tree93b60bef600d6422277195574f03c52de365f067
parent1bd218523052921327f3019ff350aca6e2ef49b6 (diff)
-Documentation
-rw-r--r--Doc/DatesInJSON.html11
-rw-r--r--Doc/SerializationSettings.html38
-rw-r--r--Src/Newtonsoft.Json/DateFormatHandling.cs2
3 files changed, 47 insertions, 4 deletions
diff --git a/Doc/DatesInJSON.html b/Doc/DatesInJSON.html
index fab328c..64e8c47 100644
--- a/Doc/DatesInJSON.html
+++ b/Doc/DatesInJSON.html
@@ -17,7 +17,12 @@
<p>DateTimes in JSON are hard.</p>
<p>
The problem comes from the <a href="http://www.ietf.org/rfc/rfc4627.txt" target="_blank">JSON spec</a> itself, there is no literal syntax for dates in JSON. The spec has objects, arrays, strings, integers and floats, but it defines no standard for what a date looks like.</p>
-<p>The default format used by <a href="http://james.newtonking.com/projects/json-net.aspx" target="_blank">Json.NET</a> for dates is the same one used by Microsoft: "\/Date(1198908717056)\/". You can read more about it <a href="http://weblogs.asp.net/bleroy/archive/2008/01/18/dates-and-json.aspx" target="_blank">here</a>.</p>
+<p>The default format used by <a href="http://james.newtonking.com/projects/json-net.aspx" target="_blank">Json.NET</a>
+ is the ISO 8601 standard: 2012-03-19T07:22Z. You can read more about it <a href="http://en.wikipedia.org/wiki/ISO_8601" target="_blank">here</a>.</p>
+ <p>Prior to Json.NET 4.5 dates were written using the Microsoft format:
+ &quot;\/Date(1198908717056)\/&quot;. If you want to use this format, or you want to
+ maintain compatibility with Microsoft JSON serializers or older versions of
+ Json.NET then change the DateFormatHandling setting to MicrosoftDateFormat.</p>
<h3>DateTime JsonConverters</h3>
<p>With no standard for dates in JSON, the number of possible different formats when interoping with other systems is endless. Fortunately Json.NET has a solution to deal with reading and writing custom dates: JsonConverters. A JsonConverter is used to override how a type is serialized.</p>
@@ -72,7 +77,9 @@
</div>
<p>Technically this is invalid JSON according to the spec but all browsers, and some JSON frameworks including Json.NET, support it. </p>
<h4>IsoDateTimeConverter</h4>
-<p>IsoDateTimeConverter seralizes a DateTime to an <a href="http://en.wikipedia.org/wiki/ISO_8601" target="_blank">ISO 8601</a> formatted string.</p>
+<p>IsoDateTimeConverter seralizes a DateTime to an <a href="http://en.wikipedia.org/wiki/ISO_8601" target="_blank">ISO 8601</a> formatted string.
+ Note that since Json.NET 4.5 dates are written using the ISO 8601 format by
+ default and using this converter is unnecessary.</p>
<div class="overflowpanel">
<div class="code">
<div style="font-size: 10pt; color: black; font-family: courier new;">
diff --git a/Doc/SerializationSettings.html b/Doc/SerializationSettings.html
index d11a80f..8092790 100644
--- a/Doc/SerializationSettings.html
+++ b/Doc/SerializationSettings.html
@@ -19,7 +19,43 @@
JSON. These can also be used with the methods on JsonConvert via the
JsonSerializerSettings overloads.</p>
- <h3>MissingMemberHandling</h3>
+ <h3>DateFormatHandling</h3>
+<p>DateFormatHandling controls how dates are serialized.</p>
+ <table class="members">
+ <tbody>
+ <tr>
+ <th class="nameColumn">
+ Member
+ </th>
+ <th class="descriptionColumn">
+ Description
+ </th>
+ </tr>
+ <tr>
+ <td>
+ <b>IsoDateFormat</b>
+ </td>
+ <td>
+ <div class="summary">
+ By default Json.NET writes dates in the ISO 8601 format, e.g. "2012-03-21T05:40Z".
+ </div>
+ <br>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <b>MicrosoftDateFormat</b>
+ </td>
+ <td>
+ <div class="summary">
+ Dates are written in the Microsoft JSON format, e.g. "\/Date(1198908717056)\/".
+ </div>
+ <br>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+<h3>MissingMemberHandling</h3>
<p>MissingMemberHandling controls how missing members, e.g. JSON contains a property
that isn&#39;t a member on the object, are handled during deserialization.</p>
<table class="members">
diff --git a/Src/Newtonsoft.Json/DateFormatHandling.cs b/Src/Newtonsoft.Json/DateFormatHandling.cs
index 47efaf4..e2fed58 100644
--- a/Src/Newtonsoft.Json/DateFormatHandling.cs
+++ b/Src/Newtonsoft.Json/DateFormatHandling.cs
@@ -6,7 +6,7 @@ namespace Newtonsoft.Json
public enum DateFormatHandling
{
/// <summary>
- /// Dates are written in the ISO 8061 format, e.g. "2012-03-21T05:40Z".
+ /// Dates are written in the ISO 8601 format, e.g. "2012-03-21T05:40Z".
/// </summary>
IsoDateFormat,
/// <summary>