Use field instead of Json.at for top level key

This commit is contained in:
stuart nelson 2016-12-12 10:45:40 +01:00
parent 0edb08fb30
commit 1d1945933b

View File

@ -67,7 +67,7 @@ alertGroupDecoder =
decodeBlocks : Json.Decoder (List Block) decodeBlocks : Json.Decoder (List Block)
decodeBlocks = decodeBlocks =
Json.maybe (Json.at [ "blocks" ] (Json.list blockDecoder)) Json.maybe (field "blocks" (Json.list blockDecoder))
|> andThen (unwrapWithDefault []) |> andThen (unwrapWithDefault [])
@ -101,7 +101,7 @@ alertDecoder =
decodeSilenced : Decoder Bool decodeSilenced : Decoder Bool
decodeSilenced = decodeSilenced =
Json.maybe (Json.at [ "silenced" ] Json.int) Json.maybe (field "silenced" Json.int)
|> andThen |> andThen
(\val -> (\val ->
case val of case val of