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:
parent
a17c2c166d
commit
8ce8f67c06
1 changed files with 3 additions and 0 deletions
|
@ -146,6 +146,9 @@ json_encode({[{_Key, _Value} | _]} = Term) ->
|
||||||
(Val, Encoder) ->
|
(Val, Encoder) ->
|
||||||
json:encode_value(Val, Encoder)
|
json:encode_value(Val, Encoder)
|
||||||
end));
|
end));
|
||||||
|
json_encode({[]}) ->
|
||||||
|
%% Jiffy was able to handle this case, but Json library does not
|
||||||
|
<<"{}">>;
|
||||||
json_encode(Term) ->
|
json_encode(Term) ->
|
||||||
iolist_to_binary(json:encode(Term)).
|
iolist_to_binary(json:encode(Term)).
|
||||||
json_decode(Bin) ->
|
json_decode(Bin) ->
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue