lpil / thoas

A blazing fast JSON parser and generator in pure Erlang.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

couple of small issues

leonardb opened this issue · comments

Firstly, great work.

Examples on README show incorrect output since you're using lists as keys/values

1> thoas:encode(#{"age" => 44, "name" => "Steve Irwin", "nationality" => "Australian"}).
<<"{\"age\":44,\"name\":[83,116,101,118,101,32,73,114,119,105,110],\"nationality\":[65,117,115,116,114,97,108,105,97,110]}">>
2> thoas:encode(#{<<"age">> => 44, <<"name">> => <<"Steve Irwin">>, <<"nationality">> => <<"Australian">>}).
<<"{\"age\":44,\"name\":\"Steve Irwin\",\"nationality\":\"Australian\"}">>

null is not being included as null in output (probably since Elixir uses nil whereas in Erlang we generally use null and that's the only case being matched

5> thoas:encode(#{dev => nil, dev2 => null}).                                                                           
<<"{\"dev\":null,\"dev2\":\"null\"}">>

See:
#7

Thank you for the report. I've fixed the README, let's talk about the rest in the PR.