Skip to content

Commit

Permalink
Fix json encode_map_checked encode_key_value_list_checked
Browse files Browse the repository at this point in the history
They where missing the enclosing curly parenthesis.
  • Loading branch information
dgud authored and Ledest committed Jun 11, 2024
1 parent 97751ea commit 4d3dff5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/otpbp_json.erl
Original file line number Diff line number Diff line change
Expand Up @@ -597,12 +597,12 @@ do_encode_map(Map, Encode) when is_function(Encode, 2) ->
-endif.

-ifdef(NEED_do_encode_checked_2).
do_encode_checked(List, Encode) when is_function(Encode, 2) -> do_encode_checked(List, Encode, #{}).
do_encode_checked(List, Encode) when is_function(Encode, 2) -> encode_object(do_encode_checked(List, Encode, #{})).

do_encode_checked([{Key, Value}|Rest], Encode, Visited) ->
EncodedKey = iolist_to_binary(key(Key, Encode)),
maps:is_key(EncodedKey, Visited) andalso error({duplicate_key, Key}),
[$,, EncodedKey, $:, Encode(Value, Encode)|do_encode_checked(Rest, Encode, Visited#{EncodedKey => true})];
[[$,, EncodedKey, $:|Encode(Value, Encode)]|do_encode_checked(Rest, Encode, Visited#{EncodedKey => true})];
do_encode_checked([], _, _) -> [].

-ifndef(NEED_key_2).
Expand Down

0 comments on commit 4d3dff5

Please sign in to comment.