Json to object array of DateTime?

Jan 5, 2010 at 4:30 PM

Hi,



is it possible to convert json

["2010-01-03T00:00:00","2010-01-10T00:00:00"]

 to 

object[] of type Datetime because I this code below to call stored procedures dynamically?


object[] Params = (object[])JsonConvert.DeserializeObject(JSON, typeof(object[])); Type currType = context.GetType(); MethodInfo currMethod = currType.GetMethod(StoredProcedureName); var SPResults = currMethod.Invoke(context, Params);

When it hits the invoke line, it fails giving me this: Object of type 'System.String' cannot be converted to type 'System.Nullable`1[System.DateTime]'.

Any ideas on how to tackle this problem?

Thanks

Coordinator
Jan 5, 2010 at 10:18 PM

IsoDateTimeConverter + deserializer to array of datetimes + cast to array of objects.