2

I have two maps in Elixir:

mapA = %{"test1" => "result1"}
mapB = %{"test2" => "result2"}

I want my output to look like this:

[%{"test1" => "result1"}, %{"test2" => "result2"}]
Adam Millerchip
  • 20,844
  • 5
  • 51
  • 74

1 Answers1

5

If you just want to put them in a list, like your example:

[mapA, mapB]
[%{"test1" => "result1"}, %{"test2" => "result2"}]

If what you actually meant is that you wanted to merge the maps:

Map.merge(mapA, mapB)
%{"test1" => "result1", "test2" => "result2"}
Adam Millerchip
  • 20,844
  • 5
  • 51
  • 74