%{
billing_contact: #Ecto.Association.NotLoaded<association :billing_contact is not loaded>,
billing_contact_id: 305,
business_contact: #Ecto.Association.NotLoaded<association :business_contact is not loaded>,
business_contact_id: nil,
disabled_message: "",
end_date: nil,
id: 6851,
is_disabled: false,
name: "test",
start_date: #DateTime<2018-08-17 12:56:50.498078Z>,
technical_contact: #Ecto.Association.NotLoaded<association :technical_contact is not loaded>,
technical_contact_id: nil,
users: #Ecto.Association.NotLoaded<association :users is not loaded>
}
I want to remove all the key value pairs where value is Ecto.Association.NotLoaded. I want to do it dynamically. So when ever there is a map come in. It automatically remove all thekey value pairs where value is Ecto.Association…
I have to send this data to the front end. so need to remove this Ecto.Association.Not loaded key value pairs.
However, if you are using Phoenix, maybe the way to go is to send the full struct to the view which should return the exactly map you want to reply as json. Maybe this view has a function call basic_user, and another full_user when you want to return the full information.