Closed amplexdenmark closed 2 years ago
Yes. Jason
does not support decoding directly into data structures - this is one of the biggest differences to Poison
that we call-out in the README
. This is usually better served by another library that can properly handle nested data structures and type validation, such as Ecto.Changeset
, Vex
, Norm
, or any similar.
Hi
I'm trying to change code that uses Poison into using Jason.
And has come upon constructs like this:
defimpl Poison.Decoder, for: CMSAPI.Model.Attribute do def decode(value, _options) do ...
Just replacingPoison
withJason
in this snippet leads to this compile error:** (ArgumentError) Jason.Decoder is not a protocol
Now looking at the code for 'Jason.Decoder' sure enough it is not a protocol, but
Jason.Encoder
is.Is this deliberate? or an oversight?
Do you have a suggestion to the easiest way for me to move forward?
Best Søren