normally, i’d do this: test_map["category"]["defaultValue"]
but i get this error in return:
iex(57)> test_map["category"]["defaultValue"]
** (FunctionClauseError) no function clause matching in Access.get/3
The following arguments were given to Access.get/3:
# 1
{:ok,
%{
"defaultValue" => 10,
"detailed" => [%{"categoryName" => "test", "categoryValue" => 23}],
"total" => 1
}}
# 2
"defaultValue"
# 3
nil
Attempted function clauses (showing 5 out of 5):
def get(%module{} = container, key, default)
def get(map, key, default) when is_map(map)
def get(list, key, default) when is_list(list) and is_atom(key)
def get(list, key, _default) when is_list(list)
def get(nil, _key, default)
(elixir) lib/access.ex:265: Access.get/3
i noticed i have a tuple with a atom :ok and a map inside it, and that’s probably why i can’t access my “defaultValue” key but i’m new in elixir/functional programming and i am having a hard time trying to find the solution.