Converting String to JSON in Data Factory

Moving data from SQL Server to Cosmos in Copy Activity of Data Factory v2. One of the column in SQL server has JSON object (Although dataType is (varchar(MAX)) and I have mapped it to one column in Cosmos collection. The issue is it adds it as String NOT json object. How can we setup it up in Copy Activity so that data for that one particular column gets added as Json Object not string

It gets added as follows:

MyObject:"{SomeField: "Value" }"

However I want this to be:

MyObject:{SomeField: "Value" } // Without quotes so that it appears as json object rather than string

Upvotes: 5

Views: 8986

Answers (1)

Kalpesh
Kalpesh

Reputation: 19

Use JSON conversion function available in Data Factory.

https://learn.microsoft.com/en-us/azure/data-factory/control-flow-expression-language-functions#json

MyObject:json("{SomeField: "Value" }")

It will result as

MyObject:{SomeField: "Value" }

Upvotes: 1

Related Questions