Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions lib/phoenix.ex
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,17 @@ defmodule Phoenix do

config :phoenix, :json_library, AlternativeJsonLibrary

The configured module is required to provide three functions:

- **`decode!/1`** — decodes a JSON binary, raising on invalid input
- **`encode!/1`** — encodes a term to a JSON binary, raising on encoding errors
- **`encode_to_iodata!/1`** — encodes a term to JSON as iodata, raising on
encoding errors.

These correspond to the single-argument, raising variants of
the functions provided by Elixir's built-in `JSON` module. A conforming
`:json_library` module does not need to implement any other functions
`JSON` has, that are not defined above.
"""
def json_library do
Application.get_env(:phoenix, :json_library, Jason)
Expand Down
Loading