Elixir newbie - I am sure I am reading the error incorrectly. Any pointers on this? The implemented protocols suggest that Jason.encode should be able to handle the term. But I get an error nevertheless. Before I massage the data into something else that Jason accepts, wanted to request pointers on how to read this error. I have a structure (stat, in the attached screen shot). i(stat) says it has implemented the Jason.Encoder protocol?
Any pointers would be deeply appreciated.
Please just copy the error message next time; it is very hare to read in a screen shot with not the greatest color scheme.
A list can be encoded, but a tuple cannot. You have a tuple as the first element of the list, so it still cannot be encoded. Jason can only encode the data structure if everything is encodable.
The data type of
stat is a list, and Jason.Encoder is indeed implemented for lists. That doesn’t mean however that Jason.Encoder is implemented for any specific item of the list. Specifically, you have a list of tuples, and the Jason.Encoder protocol is not implemented by default for tuples.
Thank you. Will copy message as is next time. Sorry about that dumb question. I get the error.
Thanks for the quick reply. That was pretty dumb of me.
No worries, just part of learning!