-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Closed
Description
We're using Json.NET 8.0.2 in a C# 4.5 project, and we love it.
However this behavior bit us pretty hard:
var obj = JsonConvert.DeserializeObject<JObject>("{ 'x': '2016-03-31T07:02:00+07:00' }");
Here, in our time zone, ob["x"].Value<string>()
returns "2016-03-31T02:02:00+02:00"
.
The problem disappears if we specify how to parse dates:
var obj = JsonConvert.DeserializeObject<JObject>("{ 'x': '2016-03-31T07:02:00+07:00' }",
new JsonSerializerSettings() { DateParseHandling = DateParseHandling.None });
But I find it dangerously surprising that by default Json.NET interprets strings as dates (let alone the performance issues this inevitably brings with it).
Is this the expected behavior? If so, is there a way to disable this behavior globally?
shift-evgeny, nbevans, thomaslevesque, FrancoisBeaune, mlaily and 124 moreAmberg, thomasbrueggemann, reder9, jeohist, lnicola and 15 more
Metadata
Metadata
Assignees
Labels
No labels