Parsing JSON
If you try to parse a JSON in elm you may run into a strange type
issue, the function Json.Decode.objectN
will return
Result.Result String Type
and not the type you thought you probably were going to
get. What is going on here is that decoding a JSON is an action that
can fail, so having decode just return your type is wrong, because it may return an error.
There are a number of ways to deal with this in the Result module but using Result.withDefault
is an easy one
See this code snipit: