DEV Community

Discussion on: #30daysofelm Day 17: I decoded some JSON!

Collapse
 
kristianpedersen profile image
Kristian Pedersen

Yeah, the original JSON is structured poorly. At first I did want to change it the way you describe, but I decided to keep it.

My thinking was that I might have to deal with other poorly structured JSON APIs in the future, but as you say, it has only made things more difficult.

Your second example is really nice to read - it's this kind of code I want to write. I would have gotten there sooner if I hadn't been so stubborn about the JSON shape, so that's a good lesson.

Also, I gotta say your first example is spectacular - the duplication at line 29 and 30 (List.map2 viewUnnamedPlanet) the nesting at line 78 (bodiesDecoder) are pure poetry. :D