Gizra/elm-compat-019/1.1.0

Json.Decode018

Elm 0.19 changed the signatures of decodeString and decodeValue.

decodeString : 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 : Decoder a -> 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.