Hey folks! I have a web service in Phoenix that returns responses in JSON format. I want Phoenix to ignore nil values in the JSON response and return only fields populated with data. This problem looks so common. Is there a Phoenix setting to ignore nil values in the response? If not can anyone recommend a plug?
Example. I have an endpoint GET /foo/ that returns {“foo”: “something”, “bar”: nil }. I want Phoenix to return {“foo”: “something”} and ignore the “bar” field.
PS I’m new in Elixir and Phoenix.