Hi all,
Given that the built-in `JSON` library is going to replace the `Jason` library, I wonder how the adoption strategy for `postgrex` could look like.
Considering the need to support the before 27 OTP versions, maybe a possible way would be to check if the JSON library is available dynamically.
Keyword.get_lazy(opts, :json, fn ->
case Application.fetch_env(:postgrex, :json_library) do
{:ok, library} ->
library
:error ->
if Code.ensure_loaded?(JSON) do
JSON
else
Jason
end
end
end)
One of the downsides is it's still a breaking change, as probably all rely on having `Jason` there by default. I'm struggling to find a way to do that without breaking changes, though.
Please let me know if you have any thoughts regarding the JSON adoption.
Kind regards,
Egor