Hi,
I have a list of key value maps like so:
[
%{k: "vacancy.state.draft", v: "concept"},
%{k: "vacancy.state.expired", v: "gone"},
%{k: "vacancy.state.online", v: "ready"},
%{k: "vacancy.name", v: "some name"},
%{k: "vacancy.title", v: "jadada"}
]
Now I’d like transform this into a map, that should look like this:
%{
vacancy: %{
state: %{
draft: "concept",
expired: "gone",
online: "ready"
},
name: "some name",
title: "jadada"
}
}
I can use String.split to get an array of keys, but looking them up and creating them when not present in the result map is a bit hard for me to wrap my head around.
I ttried using http://elixir-lang.org/docs/stable/elixir/Kernel.html#put_in/3 but I;m stuck, being very new to Elixir and all