X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=lib%2Fpleroma%2Fweb%2Ftwitter_api%2Frepresenters%2Fbase_representer.ex;h=f32a21d4724e2ae3e8c69db014415270e25c62eb;hb=c9585ec00760b46f013f36a7f7625ac36471d3e8;hp=a4ef245fc687195356239c4a0961d0175e978a19;hpb=980717fdceb39235a3f1e7f6e76d1828630f1989;p=akkoma diff --git a/lib/pleroma/web/twitter_api/representers/base_representer.ex b/lib/pleroma/web/twitter_api/representers/base_representer.ex index a4ef245fc..f32a21d47 100644 --- a/lib/pleroma/web/twitter_api/representers/base_representer.ex +++ b/lib/pleroma/web/twitter_api/representers/base_representer.ex @@ -1,15 +1,18 @@ defmodule Pleroma.Web.TwitterAPI.Representers.BaseRepresenter do defmacro __using__(_opts) do quote do - def to_json(object) do to_json(object, %{}) end + def to_json(object) do + to_json(object, %{}) + end + def to_json(object, options) do object |> to_map(options) - |> Poison.encode! + |> Jason.encode!() end def enum_to_list(enum, options) do - mapping = fn (el) -> to_map(el, options) end + mapping = fn el -> to_map(el, options) end Enum.map(enum, mapping) end @@ -17,11 +20,14 @@ defmodule Pleroma.Web.TwitterAPI.Representers.BaseRepresenter do to_map(object, %{}) end - def enum_to_json(enum) do enum_to_json(enum, %{}) end + def enum_to_json(enum) do + enum_to_json(enum, %{}) + end + def enum_to_json(enum, options) do enum |> enum_to_list(options) - |> Poison.encode! + |> Jason.encode!() end end end