devinus / poison

An incredibly fast, pure Elixir JSON library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Decoding and Encoding `nil`

Virviil opened this issue · comments

I think that encoding and decoding nil should raise ArgumentError, it should produce {:error, ArgumentError} at least. It seems to be a bug, because

iex(1)> Poison.encode(nil)
{:ok, "null"}
iex(2)> Poison.decode(nil)
** (ArgumentError) argument error
    :erlang.iolist_to_binary(nil)
    iex:35: Poison.Parser.parse/2
    iex:69: Poison.decode/2

Seems to be fixed in master branch already. I'm sorry