diff --git a/src/jsx_to_term.erl b/src/jsx_to_term.erl index aa05264..e4e5f5e 100644 --- a/src/jsx_to_term.erl +++ b/src/jsx_to_term.erl @@ -88,7 +88,7 @@ parse_config([labels|Rest], Config) -> parse_config(Rest, Config#config{labels = binary}); parse_config([{return_maps, Val}|Rest], Config) when Val == true; Val == false -> - parse_config(Rest, Config#config{return_maps = true}); + parse_config(Rest, Config#config{return_maps = Val}); parse_config([return_maps|Rest], Config) -> parse_config(Rest, Config#config{return_maps = true}); parse_config([{K, _}|Rest] = Options, Config) -> @@ -424,6 +424,10 @@ return_maps_test_() -> [{}], jsx:decode(<<"{}">>, []) )}, + {"an empty map", ?_assertEqual( + [{}], + jsx:decode(<<"{}">>, [{return_maps, false}]) + )}, {"a small map", ?_assertEqual( #{<<"awesome">> => true, <<"library">> => <<"jsx">>}, jsx:decode(<<"{\"library\": \"jsx\", \"awesome\": true}">>, [return_maps])