Dynamic JSON for Web activity
Hi all
I’m new to ADF.
I want to create a pipeline that executes a stored procedure from an Azure SQL database and sends an email with the result from the SP.
I followed these instructions to create a Logic App to send an email using a Web activity: How to send email – Azure Data Factory & Azure Synapse | Microsoft Learn
But now I’m struggling with sending the dynamic JSON the the Web Activity.
I have two variables: TextForMessage and Receiver.
Both are set in the Pipeline by a Set variable activities.
I added the Web activity, pointed to the Logic App, and added this for the Body, as explained in the link above:
“error”: {
“code”: “InvalidRequestContent”,
“message”: “The request content is not valid and could not be deserialized: ‘After parsing a value an unexpected character was encountered: “. Path ‘message’, line 2, position 17.’.”
},
“A … <truncated>
“name”: “URLBody”,
“value”: “json({n “message”:”{“”:”Text to send in the email”}”,n “receiver”:”mailaddress@domain”n})”
}
Hi all I’m new to ADF.I want to create a pipeline that executes a stored procedure from an Azure SQL database and sends an email with the result from the SP. I followed these instructions to create a Logic App to send an email using a Web activity: How to send email – Azure Data Factory & Azure Synapse | Microsoft Learn But now I’m struggling with sending the dynamic JSON the the Web Activity.I have two variables: TextForMessage and Receiver.Both are set in the Pipeline by a Set variable activities. I added the Web activity, pointed to the Logic App, and added this for the Body, as explained in the link above:{ “message”:”@{variables(‘TextForMessage’)}”, “receiver”:”@{variables(‘Receiver’)}”} I get an error, that the JSON is not formatted correctly:{“error”: {“code”: “InvalidRequestContent”,”message”: “The request content is not valid and could not be deserialized: ‘After parsing a value an unexpected character was encountered: “. Path ‘message’, line 2, position 17.’.”},”A … <truncated> To get the JOSN, I added another Set Variable activity and added the same expression to put together the JSON:{ “message”:”@{variables(‘TextForMessage’)}”, “receiver”:”@{variables(‘Receiver’)}”} This is the result (I replaced the content):{“name”: “URLBody”,”value”: “json({n “message”:”{“”:”Text to send in the email”}”,n “receiver”:”mailaddress@domain”n})”} I suppose that the expression in the Web activity generates the same output. What can I do to get a properly formatted JSON out of it? Any help is greatly appreciated. RegardsSalvatore Read More