ExUtils v0.1.1 ExUtils.Map
Elixir Utility methods for the Map
module
Summary
Functions
Converts all (string) map keys to atoms
By default converts all string keys of the map and all sub-maps
to atoms. Conversion to atoms can be limited to the base map
by specifiying recursive: false
in options
You can also call :symbolize_keys/2
instead of :atomize_keys/2
Options
Only accepts one option: recursive
with default value true
Examples
map = %{"a" => 1, "b" => %{"c" => 3, "d" => 4} }
ExUtils.Map.symbolize_keys(map)
#=> %{a: 1, b: %{c: 3, d: 4}}
ExUtils.Map.atomize_keys(map, recursive: false)
#=> %{a: 1, b: %{"c" => 3, "d" => 4}}