#How to serialize ecto Struct into json

5 messages · Page 1 of 1 (latest)

magic tangle
#

is there any simple way to serialize these structs easly with a derive or something similar (like Rust serde)?

Basically what i want to do

user = Repo.get(User, id)
json(%{user: user})
steady yew
magic tangle
steady yew
#

it works exactly like that... are you having trouble getting it to work?

plush smelt
#

If you're using ecto, you can place that right above the schema declaration.