Please help me
using generic json i have done giving output of a User and its tags this is the code
def render("user.json", %{user: user}) do
%{
name: user.name,
country: user.country,
tags: Enum.map(user.tags, &tag_to_json(&1))}
end
defp tag_to_json(tag) do
%{name: tag.name,subtype: tag.subtype, maintype: tag.maintype
}
now i transfer it to being a json-api
ive already got the main values this is the code
attributes [:name, :country]
how will i get tag.name , tag.subtype,tag.maintype?
i already tried attributes [:name, :country, :tags]
but it just returned
Poison.EncodeError
Thank you very much!