Its full name is JSON.Decode.decodeString, and it's what you want for converting anything to a string, I guess. :)
No, it's for reading from a String into any Elm type.
Instead of getPersonInfo that has to know something about Decoder and do formatting, instead just decode your JSON into a Person and then have a regular viewPerson.
You can use Json.Decode.decodeString like this to test your Decoders. Once you're ready to bring back the API stuff, you probably won't have a need for it, and instead you'll just be passing those decoders directly to Http.expectJson.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
No, it's for reading from a
String
into any Elm type.Instead of
getPersonInfo
that has to know something aboutDecoder
and do formatting, instead just decode your JSON into aPerson
and then have a regularviewPerson
.You can use
Json.Decode.decodeString
like this to test yourDecoder
s. Once you're ready to bring back the API stuff, you probably won't have a need for it, and instead you'll just be passing those decoders directly toHttp.expectJson
.