diff --git a/src/mochijson.erl b/src/mochijson.erl index 2db32c86..2895c6bf 100644 --- a/src/mochijson.erl +++ b/src/mochijson.erl @@ -118,6 +118,8 @@ json_encode(F, _State) when is_float(F) -> mochinum:digits(F); json_encode(L, State) when is_list(L); is_binary(L); is_atom(L) -> json_encode_string(L, State); +json_encode([{_K,_V}|_PropsT]=Props, State) -> + json_encode_proplist(Props, State); json_encode({array, Props}, State) when is_list(Props) -> json_encode_array(Props, State); json_encode({struct, Props}, State) when is_list(Props) -> diff --git a/src/mochijson2.erl b/src/mochijson2.erl index 954a07dc..84ce6995 100644 --- a/src/mochijson2.erl +++ b/src/mochijson2.erl @@ -139,6 +139,8 @@ json_encode([{K, _}|_] = Props, State) when (K =/= struct andalso json_encode_proplist(Props, State); json_encode({struct, Props}, State) when is_list(Props) -> json_encode_proplist(Props, State); +json_encode([{_K,_V}|_PropsT]=Props, State) -> + json_encode_proplist(Props, State); json_encode(Array, State) when is_list(Array) -> json_encode_array(Array, State); json_encode({array, Array}, State) when is_list(Array) ->