Permalink
Browse files

output a string instead of a binary

  • Loading branch information...
1 parent 18dbbc5 commit 9a2d1f3fcad72298b6dc64d6651b22e030df2706 Chris Anderson committed Aug 8, 2008
Showing with 4 additions and 3 deletions.
  1. +4 −3 json_eep.erl
View
@@ -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) ->
@@ -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).

0 comments on commit 9a2d1f3

Please sign in to comment.