Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
26 lines (18 sloc) 653 Bytes
module Decoders exposing (bookDecoder, shelfDecoder)
import Types exposing (Book, Shelf)
import Json.Decode exposing (list, int, string, float, nullable, Decoder)
import Json.Decode.Pipeline exposing (decode, required)
-- dateDecoder : Decoder Date
bookDecoder : Decoder Book
bookDecoder =
decode Book
|> required "title" string
|> required "author" string
|> required "wiki" (nullable string)
|> required "progress" float
|> required "start" string
|> required "end" (nullable string)
shelfDecoder : Decoder Shelf
shelfDecoder =
decode Shelf
|> required "shelf" (list bookDecoder)