diff --git a/src/katt_util.erl b/src/katt_util.erl index 57bece2..961761d 100644 --- a/src/katt_util.erl +++ b/src/katt_util.erl @@ -64,7 +64,8 @@ to_list(X) when is_atom(X) -> atom_to_list(X); to_list(X) when is_integer(X) -> integer_to_list(X); to_list(X) when is_float(X) -> io_lib:format("~p", [X]); to_list(X) when is_binary(X) -> binary_to_list(X); -to_list(X) when is_list(X) -> X. +to_list(X) when is_list(X) -> X; +to_list({struct, _ } = X) -> to_list(jsx:encode(value_to_jsx(X))). %% Transform (possibly utf8 encoded) binary to list, ignore everything else. from_utf8(X) when is_binary(X) ->