Azure Data Factory set variable add backslash before double quote.

Mehrsa 5 Reputation points
2023-09-22T11:01:30.3233333+00:00

In Azure Data Factory, I need to copy the output of a REST API, which is an array of nested JSONs, to a CSV file. I used a loop for the array and dynamic content for the copy activity's mapping.

I have a Pipelines_Mappings variable, it contains a JSON string with double quotes. Inside the loop, there is a set variable activity that manipulates this variable and changes the index in the string based on the loop index and assigns it to the Modified_Mappings variable. then I use the modified string, which is in the Modified_Mappings variable, in the copy activity. I set the mapping tab of the copy activity as @json(Modified_Mappings).

When I use the set variable to manipulate the json string, backslashes are added before each double quote. This causes issues with the JSON and the copy doesn't work correctly. How can I remove these backslashes? Here is part of the Pipelines_Mappings variable
"value": ""value": {\t{ "type": "TabularTranslator",

"source": {
					"path": "$['results'][@{item()}]['id']"
				},
Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
10,706 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.