This project has moved. For the latest updates, please go here. 1.3.1 javascript date parse error

May 18, 2011 at 3:53 AM


I'm restricted to version 1.3.1 because it was the last version that supported .Net framework 2.

This version used JavascriptConvert.... instead of JsonConvert...

How can I change the date output? I receive parse errors because of the "SomeProperty": new Date(...

Ideally, I need to use the Converters mentioned (like iso date etc), but all the documentation etc is for much later versions...


May 18, 2011 at 4:47 AM

I was able to use the source from a new version of the ISO Data Formatter and just include it in my application and use the converter. Here is my code for future readers:

Dim formatters(0) As JsonConverter
formatters(0) = New Newtonsoft.Json.Converters.IsoDateTimeConverter

context.Response.Write(JavaScriptConvert.SerializeObject(theObject, formatters))

context.Response.ContentType = "application/json"

The code from the newer versions of converted with no problems (I needed, the only difference was that I needed to remove the imports Linq statement etc