我有,我从JSON解析记录:解析时如何将字符串JSON值膨胀到对象?
import Json.Decode exposing (..)
import Json.Decode.Pipeline exposing (..)
type alias Article = {
pubDate: String
}
articleDecoder : Decoder Article
articleDecoder =
decode Article
|> required "pubDate" string
现在,如果我想使用Date
为pubDate
而不是原始字符串,我该如何更改代码“膨胀”与Date.fromString
JSON的价值?