Hi,
so when I Map.put even if I use the string quotation marks on the key Elixir will render the map with atoms. This is further problematic when I save data into the db as JSON, because when retrieving this data, it is all as string keys and no atoms.
Amap
|> Map.put("player_#{number}", %{
roll: false,
id: player.id,
stops_self: %{
"aether_charge": true
}})
The real use case is that, when I first create this map, it’s through an individual process, that ultimately, saves it to the db, so if the process gets killed or crashes, when being served again, the db version will be fetched.
Is there any way I can enforce a map to use string keys from the get go? So as to always have to deal with a single type of keys. I’m aware I could write a module that returns either atom or string keys but is there any easy way to be explicit about what type I want my key to be?
Thanks