Skip to content

Instantly share code, notes, and snippets.

@aeons
Last active July 24, 2024 12:43
Show Gist options
  • Save aeons/46dc0f6fb64d55f80524af6b8de19526 to your computer and use it in GitHub Desktop.
Save aeons/46dc0f6fb64d55f80524af6b8de19526 to your computer and use it in GitHub Desktop.
Erlang 27 :json module in Phoenix
config :phoenix, :json_library, ErlJson
defmodule ErlJson do
def decode!(binary), do: :json.decode(binary)
def encode!(term), do: term |> :json.encode() |> IO.iodata_to_binary()
def encode_to_iodata!(term), do: :json.encode(term)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment