View Source AppStore.JSON behaviour (App Store v0.3.1)
JSON behaviour for AppStore
Build your own JSON encoder & decoder:
defmodule MyApp.AwesomeJSONCoder do
@behaviour AppStore.JSON
@impl true
def decode!(json_string) do
Jason.decode!(json_string)
end
@impl true
def encode!(data) do
Jason.encode!(data)
end
end
Then Use the custom JSON implementation while building the client:
AppStore =
AppStore.build(
api: [
json_coder: MyApp.AwesomeJSONCoder
],
token: [
json_coder: MyApp.AwesomeJSONCoder
]
)
See AppStore.JSON.DefaultCoder
for a reference implementation.