dexonomus
Hi , please help me
i want to convert my data to json-api extension using Jaserializer
first , when using generic json i was able to extract the data preload as follows
def render(“user.json”, %{user: user}) do
%{
name: user.name,
country: user.country,
tags: Enum.map(user.tags, &tag_to_json(&1))
}
User has
name,country, list of tags as associated(include name , maintype , subtype)
Example data
{“data”:[{“tags”:[{“subtype”:“photo”,“name”:“Photo”,“maintype”:“format”}],“name”:“Alberto Giubilini”,“country”:“Singapore”}
now i want it to convert as json_api
the example code given was
attributes [:name, :country]
ive tried
-attributes [:name, :country,:tags]
but still got errors
ive tried
attributes [:name, :country]
has_many :tag,
include: true,
serializer: UserManagementWeb.Tag
but it passes null values
Trending in Questions
Other Trending Topics
Latest Phoenix Threads
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #blog-post
- #ai
- #phoenix_html
- #iex
- #elixirconf-us
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming









