Skip to content

Improve JSON and Jason support #4565

@warmwaffles

Description

@warmwaffles

Elixir version

1.18

Database and Version

all

Ecto Versions

any

Database Adapter and Versions (postgrex, myxql, etc)

postgrex, myxql, exqlite

Current behavior

When running Elixir 1.18 and setting the json adapter to JSON, we encounter issues where encode/1 is not defined, but encode!/1 is. This issue was started here elixir-sqlite/ecto_sqlite3#159

Expected behavior

I should be able to flip between Jason and JSON to support Elixir 1.17 and 1.18.

A "quick-ish" fix is to wrap the encode!/1 from both Jason and JSON with a try rescue to keep the {:ok, term} | {:error, term} typespec behaviour.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions