Skip to content

JSON vs Jason incompatibility #14317

@maxsalven

Description

@maxsalven

Elixir and Erlang/OTP versions

Erlang/OTP 27 [erts-15.2.3] [source] [64-bit] [smp:10:10] [ds:10:10:10] [async-threads:1] [jit]

Elixir 1.18.3 (compiled with Erlang/OTP 27)

Operating system

Mac OS

Current behavior

input = ~c"{}"

Jason.decode!(input)
%{}

JSON.decode!(input)
** (FunctionClauseError) no function clause matching in JSON.decode!/1

    The following arguments were given to JSON.decode!/1:

        # 1
        ~c"{}"

    Attempted function clauses (showing 1 out of 1):

        def decode!(binary) when is_binary(binary)

    (elixir 1.18.3) lib/json.ex:327: JSON.decode!/1
    iex:4: (file)

Expected behavior

I'm having issues with third party modules causing crashes when trying to switch to JSON.

Should JSON decode a charlist for Jason compatibility?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions