We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b480f12 commit 0ca877fCopy full SHA for 0ca877f
1 file changed
src/misc.erl
@@ -126,18 +126,16 @@ json_encode(Term) ->
126
json_decode(Bin) ->
127
jiffy:decode(Bin, [return_maps]).
128
-else.
129
-json_encode({[{_Key, _Value} | _]} = Term) ->
+json_encode({[]}) ->
130
+ %% Jiffy was able to handle this case, but Json library does not
131
+ <<"{}">>;
132
+json_encode(Term) ->
133
iolist_to_binary(json:encode(Term,
134
fun({Val}, Encoder) when is_list(Val) ->
135
json:encode_key_value_list(Val, Encoder);
136
(Val, Encoder) ->
137
json:encode_value(Val, Encoder)
- end));
-json_encode({[]}) ->
- %% Jiffy was able to handle this case, but Json library does not
138
- <<"{}">>;
139
-json_encode(Term) ->
140
- iolist_to_binary(json:encode(Term)).
+ end)).
141
142
json:decode(Bin).
143
-endif.
0 commit comments