This project has moved and is read-only. For the latest updates, please go here.

Slashes added to DateTime Serialization

Jun 2, 2008 at 10:31 PM
I was just wondering why slashes "/" are added before and after the date when its serialized (eg \/Date(123456789)\/)? The method I'm looking at is JavaScriptConvert.ToStringInternal.
Jun 8, 2008 at 9:53 AM
Jun 9, 2008 at 2:33 AM
I was actually doing that very thing (replacing the \/Date/\ with new Date()) I just couldn't figure out why it wasn't done on the server side, but now I know. Thanks.
Jun 9, 2008 at 9:38 AM
FYI there is a JsonConverter that comes with Json.NET which outputs 'new Date()'
Jun 12, 2008 at 2:43 PM
apparently, jQuery does not like parsing JSON with dates in this format. it returns them as a string like so:


It is possible to parse this into a usable javascript date object but a pain none the less.

I am using Castle MonoRail, and the latest version of the trunk is using 2.0, but because of the difficulty of getting all three frameworks to play nicely I went back to 1.3.2 in which MonoRail is outputting the dates as new Date()

Any easy way of getting this to work with the jQuery JSON parser?
Jun 14, 2008 at 4:35 AM
Use the JavaScriptDateTimeConverter when serializing...