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