I'm started using fastjson_api, I have implemented attribute-based control in my project how do reject the attributes when I'm returning the JSON data.
For Example:-
I have a customer table where it has customer name, email, phone, address
For some roles, I may give access to phone number and for some, I'll not give them access
not_allowed_attributes = ["phone"] 
class CustomerSerializer
  include FastJsonapi::ObjectSerializer
  attributes :name, :email, :phone  
  attribute :phone do |object|
    unless not_allowed_attributes.include?"phone"
      object.phone
    end
  end
end
But It is not a dynamic way of implementing, so whenever there is changed in not_allowed_attributes it should dynamically filter out the attributes from the JSON response.
For role1 not_allowed_attributes = ["email","phone"]
for role2 not_allowed_attributes = ["phone"]  
not_allowed_attributes I'll send it in params for the serializer and there is it possible to remove the attributes based on their role.