Happy Little Trees: Decoding Recursive Data Structures in Elm

You know how you stay up late trying to figure out why your recursive types just. won’t. decode? I’ve done it too. Wouldn’t it be nice if it would, you know, just work how you wanted it to? Fortunately, Json.Decode.Extra.lazy exists, so it you can get it to work right away!

Read on

JSON Schema Changes: A Halloween Horror Story

You’re hacking along on your JSON decoder. Life is rosy, the birds are singing, the sun is shining, but then… you get an email: JSON Schema change.

(lightning cracks, a vampire cackles in the distance)

So how do you deal with that? You’re not just gonna give up, but your data model is already pretty set. Are you going to have to change everything?

Read on

JSON Street in Elm Town

Last week Murphy Randle had me on Elm Town as a guest to talk about JSON. We walked through the Elm JSON.Decode documentation, and talked about hairy things we’d run into. If you want a good overview of the landscape for the JSON.Decode API, give it a listen.

Read on

Composing Decoders like LEGO

First-time Elm users have a hard time learning how to compose decoders. People tend to get stuck on what they all mean, but it’s not too hard: just think of them like LEGO.

Read on

Debugging JSON

A recurring theme in the Elm community (and this blog) is that JSON is kind of difficult to get started with. This makes sense, since it’s all about dealing with data that other people provide for us. It’s hard to debug what’s happening with JSON decoders since they’re often used in HTTP response decoders. So today we’re going to talk about some general advice: how do you even debug JSON?

Read on