'Data Factory: How to pass JSON as text to Web Body
I have to pass multiple records from a SQL source to the body of a web call in Data Factory in JSON format.
eg.
{"EmployeeCode":"1234",""FirstName":"Joe","LastName":"Bloggs"}
{"EmployeeCode":"5678",""FirstName":"Jack","LastName":"Ryan"}
However, I cannot seem to do it without ADF adding escape characters "\".
{\\"EmployeeCode\\":\\"1234\\",\\"\\"FirstName\\":\\"Joe\\",\\"LastName\\":\\"Bloggs\\"}"
So far I have tried:
- Copy activity - Formatted SQL as JSON
- Copy activity - SQL output to BLOB JSON
- Copy activity - SQL concatenated string output
Does anyone have a process by which to achieve this? I am hoping I have missed something easy.
Thanks in advance....
Solution 1:[1]
Escape character backslash \
appears wherever double quotes "
are used in the string in the Azure data factory.
Thank you @GregGalloway for your valuable input in the comments sections. As @GregGalloway mentioned, convert the string to JSON format in the web body as shown in the below example.
Example:
- Source: SQL data
- Getting SQL records using lookup activity.
- Passing the output record to web activity in JSON format.
@json(activity('Lookup1').output.value[0].description)
The input of the web activity body is shown as below in JSON format:
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 | NiharikaMoola-MT |