Older article by Matthew Buscemi in which he focuses on his 6 month experience with Elm language and translation of object-oriented patterns for scalable, maintainable architecture to Elm’s paradigm. For communicating between Atom editor and his Elm application, he needed ports, and in order to work with Elm Test output, he needed JSON decoders.
JSON decoders are a notorious pain point for newcomers to Elm.
Stages explained in the article:
- Everything’s a record!
- Dealing with variant/missing fields
- Trying multiple variants with oneOf
- Introducing the value type
- JSON value/elm type independencevalue/elm type independence
Exhaustive list of code examples included. JSON became truly a transport mechanism for the web. If you find yourself struggling with JSON decoders, try to start with the simplest thing that could work. Link to further reading provided, too. Good read!
[Read More]