LitJSON / litjson

JSON library for the .Net framework
https://litjson.net/
Other
1.37k stars 404 forks source link

Option to force DateTimes to deserialize as Utc #28

Open michaelbartnett opened 10 years ago

michaelbartnett commented 10 years ago

Things got a little messy in the last version of this PR (#20), so it seemed easier to just rebase from upstream/master and try again.

Here's the notes copied from there:

The default DateTime deserialization will set the DateTimeKind to Local if there's timezone information in the string. This makes sense, but timezones are a >PITA to manage, and being able to guarantee everything comes out as UTC is pretty important (to me, at least).

Adds JsonMapperOptions flags enum, and a static Options member in the JsonMapper class.

The behavior is enabled by a global flag which is a little gross, so maybe some sort of JsonMapper context could be useful in the future.