Search code examples
azure-data-factory

Data Flow Expression Builder - Add JSON with parameters


I am trying to set up an Azure Data Factory data flow where the sink is a POST call. I need to change the contents of the body on the fly, so I'm trying to insert parameters into the JSON via the expression builder:

{   
     "Item1": "\"$Param1"\",   
     "Item2": "\"$Param2"\",   
     "Item3": "\"$Param3"\",   
     "Item4": "\"$Param4"\" 
}

The params go green as expected, but I am still getting "unable to parse" errors on the content inside the brackets.

How do you input JSON in the ADF data flow expression builder?

Screenshots, if helpful:

enter image description here

enter image description here


Solution

  • Figured it out. You can escape curly braces and double quotes by using single quotes, like so:

     '{' +
         '"Item1":"' + $Item1 + '",' +
         '"Item2":"' + $Item2 + '",' +
         '"Item3":"' + $Item3 + '",' +
         '"Item4":"' + $Item4 + '",' +
    '}'