You can probably create a custom ecto type which would accept and load both arrays and maps.
defmodule IsItMapIsItArrayWhoKnowsEctoDoes do
@behaviour Ecto.Type
# ... other callbacks ...
@impl true
def load(value) when is_list(value) or is_map(value) do
{:ok, value}
end
end
I haven’t tried it though.