为什么ServiceStack.Text不会默认日期以ISO8601? [英] Why ServiceStack.Text doesn't default dates to iso8601?

查看:280
本文介绍了为什么ServiceStack.Text不会默认日期以ISO8601?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我用Newtonsoft.Json.NET则默认为ISO8601(例如: 2011-06-02T09:34:29 + 02:00 )的序列化/反序列化日期

If I use Newtonsoft.Json.NET it defaults to iso8601 (i.e.: 2011-06-02T09:34:29+02:00) for serializing/deserializing dates.

为什么ServiceStack.Text不默认为此,我需要将其指定为配置设置?

Why ServiceStack.Text doesn't default to this and I need to specify it as a configuration setting?

推荐答案

ServiceStack跟着.NET DataContractSerailizer默认值,不能JSON.NET。我们都不愿意作出这样重大更改,尤其是当有一个简单的方法,它以其他方式配置:

ServiceStack followed the .NET DataContractSerailizer defaults, not JSON.NET. We are reluctant to make breaking changes like this, especially when there's an easy way to configure it otherwise with:

JsConfig.DateHandler = DateHandler.ISO8601; 

这篇关于为什么ServiceStack.Text不会默认日期以ISO8601?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆