在 ARM 模板中格式化双引号 json 转义字符串

Format the double quoted json escape string in ARM template

我必须动态绑定服务 url,以便通过 ARM 部署进行 swagger 导入。

我试图在 ARM 模板中格式化转义的 json 字符串,如下所示

"value": "[format('\"{\"swagger\":\"2.0\",\"host\":\"{0}\"}\"', parameters('ApimServiceUrl'))]",

但我越来越像 'Input string was not in a correct format.' 如何在转义字符串中绑定 ARM 参数值。

像这样的东西应该可以工作:

"[concat('\"{\"swagger\":\"2.0\",\"host\":\"', parameters('ApimServiceUrl'), '\"}\"')]"

此外,我认为 json 中的所有内容都应使用 \\:

进行转义
"[concat('\"{\\"swagger\\":\\"2.0\\",\\"host\\":\\"', parameters('ApimServiceUrl'), '\\"}\"')]"