Hi Avneet,
The return type of the Azure function has to be a valid JObject. (Keep in mind that JArray is not a JObject.) Any return type other than JObject fails and raises the user error Response Content is not a valid JObject.
Feel free to reach out to me if you have any questions or concerns.
Thanks
Deepanshu