在我的Xamarin应用程序中,我试图使用NewtonSoftJSON将dataset序列化为JSON,但仍然存在以下错误
在“System.Globalizes.DateTimeFormatInfo”上从“NativeCalendarName”获取值时出错。
虽然我没有在数据集中使用任何日期时间,但我正面临错误。请帮我解决同样的问题。谢谢,到目前为止我已经做了
string output = JsonConvert.SerializeObject(dsComp, Newtonsoft.Json.Formatting.None,
new Newtonsoft.Json.JsonSerializerSettings()
{
ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore
});
using(var streamWriter = new System.IO.StreamWriter(filename, true))
{
streamWriter.WriteLine(output);
}发布于 2015-11-06 15:27:55
您必须告诉如何序列化Datetime格式。尝尝这个
string output = JsonConvert.SerializeObject(dsComp, Newtonsoft.Json.Formatting.None,
new JsonSerializerSettings()
{
ReferenceLoopHandling = ReferenceLoopHandling.Ignore,
DateFormatHandling = DateFormatHandling.IsoDateFormat
}); https://stackoverflow.com/questions/33569654
复制相似问题