Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

.NET has no trouble going between ISO-8601 and the native DateTime type.


If you have a priori knowledge of the schema (say, mapping to/from classes) you can convert anything. You don't even need something like JSON, you could just have a binary format and IDL.

JSON self-describes booleans, numbers, strings, arrays, objects, and null. This is especially convenient when working with dynamic or ambiguous structures, and working in dynamically typed languages. Timestamp is sufficiently common and useful that it should be added to that list.

If you mean ".NET parser pattern matches strings and converts them dynamically" - that's the same horrible behavior yaml parsers have and it causes endless trouble. Imagine parsing titles of posts and some clever author makes a title that matches the timestamp format.


The .NET parser will only parse ISO-8601 to a DateTime if that's the type you tell it to accept. If you tell it to accept a string, it won't try to do anything funny no matter what that string may look like.


When .Net just started, they would deserialzie datetime to... a string which looked something like `DateTime\(2007-12-10\)`.

10-15 years later I'm still baffled by that early decision (and glad it's been fixed since then)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: