Skip to content

Instantly share code, notes, and snippets.

@ericentin
Last active August 29, 2015 14:26
Show Gist options
  • Save ericentin/a45b94f1bdac84991543 to your computer and use it in GitHub Desktop.
Save ericentin/a45b94f1bdac84991543 to your computer and use it in GitHub Desktop.
defmodule KeysToAtoms do
def keys_to_atoms(%{} = map) do
Enum.map(body, &{String.to_atom(&1), keys_to_atoms(&2)})
|> Enum.into(%{})
end
def keys_to_atoms(list) when is_list(list) do
Enum.map(list, &keys_to_atoms/1)
end
def keys_to_atoms(any), do: any
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment