1
0
Fork 0
mirror of https://github.com/processone/ejabberd synced 2025-10-03 01:39:35 +02:00

misc: Add workaround for Json library not able to handle empty list

This commit is contained in:
Badlop 2025-07-15 10:36:24 +02:00
parent a17c2c166d
commit 8ce8f67c06

View file

@ -146,6 +146,9 @@ json_encode({[{_Key, _Value} | _]} = Term) ->
(Val, Encoder) ->
json:encode_value(Val, Encoder)
end));
json_encode({[]}) ->
%% Jiffy was able to handle this case, but Json library does not
<<"{}">>;
json_encode(Term) ->
iolist_to_binary(json:encode(Term)).
json_decode(Bin) ->