Closed youngsing closed 5 years ago
可以配置的,你的 JSON 数据是什么样的呢?
Date(timeIntervalSinceNow: 1512217128)
默认是用这个方法解析时间戳转成 Date 的。
我这边JSON数据里面其实是没有Date
类型数据的,我只是想在转换的时候插入一个当前时间戳。。
然后我看JSONAdapter
里面好像没有Date
相关协议,CleanJSONDecoder.options
好像也不是公开属性?是有其它什么途径来配置吗?
JSONAdapter
暂时不支持 Date
类型.
建议你设一个默认值.
多谢,我再研究研究!
不过像"time": 1553875884
这种Unix
时间戳,由现在默认的DateDecodingStrategy.deferredToDate
解析出来是不对。
上面的代码没有生效,看源码里面解析的时候用的是
self.options.dateDecodingStrategy
,这个在库外面可以配置吗?