Return JSON from Azure Functions with Python

I was working on an Azure Function for an open source wildlife IoT project and came across a lack of documentation in 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 (
            'lat': lat,
            'lon': lon



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s