Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- defimpl Poison.Encoder, for: Any do
- def encode(%{__struct__: _} = struct, options) do
- map = struct
- |> Map.from_struct
- |> sanitize_map
- Poison.Encoder.Map.encode(map, options)
- end
- defp sanitize_map(map) do
- Map.drop(map, [:__meta__, :__struct__])
- end
- end
Add Comment
Please, Sign In to add comment