'How do i receive json string from Azure Function to save like json file in blob storage

I have a flow on Power Automate. It will post a json-string to my azure function. How can i write this json to a json file in blobs storage using Azure Data Factory or only Azure Function ?



Solution 1:[1]

Below is a sample where you can save JSON through the azure function. For example, Considering this to be my workflow

enter image description here

I am using HTTP trigger in my case and sending the JSON sample to my function app which has output binding as blob storage and My Http function App looks like this:-

init.py

from http.client import HTTPResponse
import logging

import azure.functions as func


def main(req: func.HttpRequest,outputblob: func.Out[str]) -> func.HttpResponse:
    logging.info('Python HTTP trigger function processed a request.')

    print(str(req.get_json()))

    outputblob.set(str(req.get_json()))

function.json

{
  "scriptFile": "__init__.py",
  "bindings": [
    {
      "authLevel": "anonymous",
      "type": "httpTrigger",
      "direction": "in",
      "name": "req",
      "methods": [
        "get",
        "post"
      ]
    },
    {
      "name": "outputblob",
      "type": "blob",
      "path": "outputcontainer/sample.json",
      "connection": "AzureWebJobsStorage",
      "direction": "out"
    }
  ]
}

enter image description here

RESULT :

In power Automate

enter image description here

In function app

enter image description here

In Storage Account

enter image description here

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 SwethaKandikonda-MT