Skip to content

Commit

Permalink
output a string instead of a binary
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Anderson committed Aug 8, 2008
1 parent 18dbbc5 commit 9a2d1f3
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions json_eep.erl
Expand Up @@ -42,9 +42,10 @@ term_to_json(T) ->
S = json_encode(T),
case is_list(S) of
true ->
list_to_binary(S);
% I don't know why this helps
binary_to_list(list_to_binary(S));
false ->
S
binary_to_list(S)
end.

json_to_term(S) ->
Expand Down Expand Up @@ -240,7 +241,7 @@ test_next([{E,J}|Rest]) ->
Term = json_to_term(J),
?LOG("Decoded ~p~n", [Term]),
true = equiv(E, Term),
Json = binary_to_list(term_to_json(Term)),
Json = term_to_json(Term),
?LOG("Encoded ~s~n~n", [Json]),
true = equiv(Term, json_to_term(Json)),
test_next(Rest).
Expand Down

0 comments on commit 9a2d1f3

Please sign in to comment.