Elm 0.19 changed the signatures of decodeString
and decodeValue
.
decodeString : Json.Decode.Decoder a -> String -> Result String a
Parse the given string into a JSON value and then run the Decoder
on it.
This will fail if the string is not well-formed JSON or if the Decoder
fails for some reason.
import Json.Decode exposing (int)
decodeString int "4" --> Ok 4
decodeString int "1 + 2" == Err ...
decodeValue : Json.Decode.Decoder a -> Json.Encode.Value -> Result String a
Run a Decoder
on some JSON Value
. You can send these JSON values
through ports, so that is probably the main time you would use this function.