azure - How to escape json in dynamic content in ADF V2 in Azure?
问题描述
I'm calling Azure function and I'm building the request body using dynamic content.
This is how I build it:
{
"test": "Test1",
"data": "@{activity('Upload SKU').output}"
}
I have problem with the "data" node. @{activity('Upload SKU').output
is a json string.
So the dynamic content creates "mess". It doesn't escape it.
It creates this:
{
"test": "Test1",
"data": "{"a": "1"}"
}
How to escape @{activity('Upload SKU').output
so that {"a": "1"}
creates {\"a\": \"1\"}
so that it can be treated as a string and not as a node under "data"
.
This is what I want to achieve:
{
"test": "Test1",
"data": "{\"a\": \"1\"}"
}
解决方案
您可以从我之前的案例中得到一些线索:Error "BadRequest" when calling Azure Function in ADF。
解决方案是在动态内容中使用@json()
和@concat()
。对于您来说,整个data
可能看起来像:
@json(concat('{"test": "Test1,"data":"',@{activity('Upload SKU').output,'"}'))
仅作总结:
事实证明,ADF 表达式编辑器中存在错误,因为当@Hooch 将完全相同的表达式直接放入“body”字段而不使用表达式编辑器时,它可以工作。
推荐阅读
- c++ - for循环openmp中的局部变量
- c++ - FreeImage 错误的图像颜色
- javascript - Vue.js 2 如何在没有无限循环的情况下在 v-for 循环中填充 Vue 数据
- bash - 停用 conda 环境时如何从 PATH 中删除目录
- grafana - Grafana 快照 - 所需的数据是从源存储还是从源获取?
- swift - 如何在导航栏中的标题下放置分段控件(如 Telegram App)
- google-analytics - 谷歌分析新用户是否受回溯期影响?
- java - 在运行时编译java文件
- java - 如何使用特定的 JRE 执行 jarsigner
- c - 运算符在while循环中的工作(c编程)