# Map.keys convert to string

**URL:** <https://forum.elixirforum.com/t/map-keys-convert-to-string/4943>\
**Category:** Discussions\
**Tags:** book-elixir-in-action, book-introducing-elixir\
**Created:** [May 4, 2017, 7:44pm UTC](https://forum.elixirforum.com/t/map-keys-convert-to-string/4943 "2017-05-04T19:44:30Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Qqwy](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/qqwy/32/1349_2.png) [@Qqwy](https://forum.elixirforum.com/u/Qqwy)\
**Post date:** [May 4, 2017, 7:51pm UTC](https://forum.elixirforum.com/t/map-keys-convert-to-string/4943/2 "2017-05-04T19:51:03Z")

</div>

Rather than `Enum.each`, you will want to use `Enum.join`.

Example:

```elixir
data = %{"foo" => 1, "bar" => 2, "baz" => 0}

data |> Map.keys |> Enum.join(",")

```

For more general iterations where you are accumulating results, using `Enum.each` is usually not what you want, but instead, `Enum.reduce`.

---

_[View the full topic](https://forum.elixirforum.com/t/map-keys-convert-to-string/4943)._
