Phoenix.Jiffy
JSON Engine replacement for Phoenix. Mimics default JSON engine (Poison), but uses
Jiffy under the hood.
Installation
If available in Hex, the package can be installed as:
-
Add
phoenix_jiffyto your list of dependencies inmix.exs:
```elixir
def deps do
[{:phoenix_jiffy, "~> 0.1.0"}]
end
```-
Ensure
phoenix_jiffyis started before your application:
```elixir
def application do
[applications: [:phoenix_jiffy]]
end
```-
Add to
config/config.exs:
```elixir
config :phoenix, :format_encoders,
json: Phoenix.Jiffy
```-
Change your
endpoint.ex:
```elixir
defmodule MyApp.Endpoint do
use Phoenix.Endpoint, otp_app: :my_app
...
plug Plug.Parsers,
parsers: [:urlencoded, :multipart, :json],
pass: ["*/*"],
json_decoder: Phoenix.Jiffy
...
end
```