always return maps if the macro maps_always
is defined
This commit is contained in:
parent
8592742ded
commit
d4d838d4f4
2 changed files with 8 additions and 1 deletions
|
@ -1,4 +1,6 @@
|
|||
{erl_opts, [
|
||||
% uncomment to always decode to maps
|
||||
% {d, maps_always},
|
||||
{platform_define, "R14|R15", 'no_binary_to_whatever'},
|
||||
{platform_define, "^((?!R1[456]).)*$", 'maps_support'}
|
||||
]}.
|
|
@ -69,9 +69,14 @@
|
|||
|
||||
-spec to_term(Source::binary(), Config::config()) -> json_value().
|
||||
|
||||
-ifdef(maps_always).
|
||||
to_term(Source, Config) when is_list(Config) ->
|
||||
(jsx:decoder(?MODULE, [return_maps] ++ Config, jsx_config:extract_config(Config)))(Source).
|
||||
-endif.
|
||||
-ifndef(maps_always).
|
||||
to_term(Source, Config) when is_list(Config) ->
|
||||
(jsx:decoder(?MODULE, Config, jsx_config:extract_config(Config)))(Source).
|
||||
|
||||
-endif.
|
||||
|
||||
parse_config(Config) -> parse_config(Config, #config{}).
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue