I am working with an existing web api. I upload a list of JSONObjectA to the server this then returns a list of JSONObjectB. This all works fine and I am happy with that. A problem arises when I send a list of 1 to the server. Instead of a List of one being returned, I only receive JSONObjectB. This means I need different Serializers to parse the data.
Would it make more sense for the server to always return a list (ie. always the same object) or would it be considered good practice to do it the current way?
It would make more sense to always return a list. When building an API you should always go for ease of use, and having 2 different types returned means that the API user has to do additional work that they shouldn’t need to.