Last active
April 1, 2025 00:33
-
-
Save aeons/46dc0f6fb64d55f80524af6b8de19526 to your computer and use it in GitHub Desktop.
Erlang 27 :json module in Phoenix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
config :phoenix, :json_library, ErlJson |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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