Packages

Money functions for operations on and localization of a money data type with support for ISO 4217 currencies and ISO 24165 digial tokens (crypto currencies).

Current section

Files

Jump to
ex_money lib money protocol json.ex
Raw

lib/money/protocol/json.ex

if Cldr.Config.ensure_compiled?(JSON) &&
!Money.exclude_protocol_implementation(JSON.Encoder) do
defimpl JSON.Encoder, for: Money do
def encode(struct, encoder) do
struct
|> Map.take([:currency, :amount])
|> encoder.(encoder)
end
end
end