Get a map with %{key: value} from nested of map

From the following nested map

result = %Team.Message{
--------,
--------,
--------,
--------
  data: %User{
    __uf__: [],
    id: "a1",
    content: %{
      name: "james",
      id: "1-18xxd",
      type: "game",
      group_id: "T21",
      team_id: "us2",
      round_id: "SP1",
      user_id: "12hvf"
    },
--------,
--------,
--------,
--------
  },
  message: %{
    --------,
    --------
  },
  status: :ok
}

I want to get the final map as

result = %{ name: "james", id: "1-18xxd", group_id: "T21", team_id: "us2",round_id: "SP1"}

So that I can use it as ,for eg : result.name

Can someone please help me with it?

Thanks in advance.

result.data.content if I’m not missing sth here

3 Likes