I was working on an Azure Function for an open source wildlife IoT project and came across a lack of documentation in docs.microsoft.com. I had successfully returned HTTP content from my Azure function, but wasn’t sure how to get it to return JSON so I could interpret it elsewhere. In this case I’m storing latitute (lat) and longitude (lon) and returning them in JSON content:
Here’s the block:
#at the top
import json
#to return
return func.HttpResponse (
json.dumps({
'lat': lat,
'lon': lon
})
)
Enjoy!
Nathan