I am facing a scenario where my API returns a single JSON Object if there is only one element in the response, and an array of objects if there are more than one elements. This poses a challenge as I need to handle both cases without changing the JSON structure.
While I can use the javascript controller to always treat the response as an array and loop through it using ng-repeat, this approach also affects properties within the JSON object. As such, I am seeking a solution within Angular 1.x that allows me to display the data seamlessly, regardless of whether it is a single object or an array of objects.
Given that I may need to update the record via the API, maintaining the current JSON structure is crucial. Is there a straightforward way in Angular to accomplish this?