Elixir - Poison
12 Jun 2017Poison.decode!
vs. Poison.Parser.parse!
https://stackoverflow.com/a/41788994/3632318
They seem to produce the same results unless you’re using the more advanced options of Poison.decode!. I guess using Poison.decode! should be alright, although the Readme suggests using Poison.Parser.parse! for simple JSON parsing.
using structs
https://elixir-lang.org/getting-started/protocols.html#implementing-any
derive only Protocol.Encoder
protocol implementation for encoding the struct:
defmodule Neko.Achievement do
@derive [Protocol.Encoder]
defstruct ~w(id name)a
end
it’s not necessary to derive Protocol.Decoder
for decoding into struct
(though it won’t raise an error).