Permalink
Browse files

break out json_encode for atoms into its own function head

  • Loading branch information...
1 parent 5991c01 commit 1d855b6bd6a23f16980b6bc7c838b0e561145b7e @onkel-dirtus committed Aug 11, 2011
Showing with 3 additions and 1 deletion.
  1. +3 −1 src/mochijson2.erl
View
@@ -135,7 +135,9 @@ json_encode(I, _State) when is_integer(I) ->
integer_to_list(I);
json_encode(F, _State) when is_float(F) ->
mochinum:digits(F);
-json_encode(S, State=#encoder{encode_atoms=true}) when is_binary(S); is_atom(S) ->
+json_encode(S, State) when is_binary(S) ->
+ json_encode_string(S, State);
+json_encode(S, State=#encoder{encode_atoms=true}) when is_atom(S) ->
json_encode_string(S, State);
json_encode([{K, _}|_] = Props, State) when (K =/= struct andalso
K =/= array andalso

0 comments on commit 1d855b6

Please sign in to comment.