私はJSONからパースレコードを持っている:私は代わりに生の文字列のpubDate
ためDate
を使用したい場合は解析するときに文字列の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.fromString
でJSON値を「膨らませる」ようにコードを変更できますか?これが動作するように見えます