I am trying to parse plain JSON using Json.net
string inputJson = @"
{
""modificationTime"" : ""\/Date(1224043200000)\/""
}";
And the property is defined
[JsonProperty("modificationTime")]
[JsonConverter(typeof(JavaScriptDateTimeConverter))]
public DateTime ModificationTime { get; set; }
But DeserializeObject throws an exception with the following message: "Unexpected token or value while parsing the date. Token: date, value: 10/15/2008 04:00:00"
Well, as far as I can see, he actually made out the date, right? This exception is thrown from line 68 in JavaScriptDateTimeConverter.cs:
68 if (reader.TokenType != JsonToken.StartConstructor || string.Compare(reader.Value.ToString(), "Date", StringComparison.Ordinal) != 0)
69 throw new Exception("Unexpected token or value when parsing date. Token: {0}, Value: {1}".FormatWith(CultureInfo.InvariantCulture, reader.TokenType, reader.Value));
70
71 reader.Read();
In this place, reader.TokenType is Date and reader.Value.ToString () is 10/15/2008 04:00:00. Any ideas?
source
share