Closed vittoriabitton closed 1 year ago
You can implement it by yourself, e.g.
defimpl Jason.Encoder, for: Stripe.Customer do
def encode(struct, opts) do
# Note that it is just an example and not necessarily correct implementation for your case
data
|> Map.from_struct()
|> Map.drop([:__struct__])
|> Jason.Encode.map(opts)
end
end
or derive it using derive/3
I'm processing some Stripe Customers using
retrieve/2
for aStripe.Customer
and while trying to fetch its attributes I keep getting:PS: data from this is using
stripe-mock
service.The to-go solution for this would be adding
@derive {Jason.Encoder, only: [....]}
to stripity-stripeStripe.Customer
model or there is another possible workaround for this?Thanks in advance :)