Our organization has two approaches to the problem:
- Sending data as JSON as opposed to POST-data is a good all-purpose approach, though this is sometimes a little bit difficult to integrate with frameworks like Rails, because you may have to add explicit back-end calls to decode the JSON data.
[""]as noted by vinod will work well, as many frameworks (e.g. Rails) will often treat this as an empty array. (for the reason, see this Stack Overflow answer).- Note: This works when trying to integrate with some aspects of Rails, specifically when sending a list of ids of objects that are related by a
has_manyrelationship. E.g. if you have afoostable and abarstable, andfooshas_many :bars through :foo_bars, a way to remove all associations on afooobject is to passfoo: { bar_ids: [""] }.
- Note: This works when trying to integrate with some aspects of Rails, specifically when sending a list of ids of objects that are related by a
Both approaches are hackier than desired, and I would be glad to discover a cleaner approach.