I am sending a DateTime
instance to the browser using NancyFX. The object that contains the date gets serialized as:
{ "foo": "\/Date(1378108800000)\/", "bar": "baz", … }
Now my question is how to deal with that serialized date value. Apparently, I can not hand it over to a Date
constructor call in JavaScript. Of course I could use substring
and / or a regular expression to strip out the number and hand that over to the Date
constructor, but I guess that there must be a more intelligent (= standard) way.
Any hints?
PS: I have seen How to serialize DateTimeOffset as JSON in NancyFX?, but that does not answer my question.