Encoding Ecto structs into JSON
Today’s episode covers one simple problem—how to encode Ecto structs into JSON.
There are a few ways to do it, but using @derive in the struct’s definition to implement the Poison.Encoder protocol is the cleanest way.
Read next Elixir, Phoenix, CSRF tokens and gloomy foreteller