to_hash handles recursive list types