0
    {
      "Query": {
        "inputs": {
          "headers": {
            "Content-Type": "application/json"
          },
          "method": "GET",
          "queries": {
            "f": "json",
            "temp": "\"test\": @json(body('http'))['candidates'][0]['location']['x']"
          },
          "uri": "https://testurl.com/restApi"
        },
        "runAfter": {

        },
        "type": "Http"
      }
    }

It reads "temp" as "test" : @json(body('http'))['candidates'][0]['location']['x']"

If I change this line to

    "temp": "@json(body('http'))['candidates'][0]['location']['x']"

It read the correct value from json. Not sure if its a bug, or I am missing some syntax.

4

2 回答 2

3

您可以尝试 Steven 回答的内容(https://stackoverflow.com/a/44062649/7997843)或者这对我来说更明确:

"temp": "@concat('\"test\":', json(body('http'))['candidates'][0]['location']['x'])"

我建议您在此处阅读有关工作流定义语言中的字符串插值:https ://docs.microsoft.com/en-us/azure/logic-apps/logic-apps-workflow-definition-language#Expressions

你的情况似乎是一个极限情况。要么你用@ou开始你的表达式,@{然后你的函数的名字,或者你可以从一个字符串开始,但是你别无选择,只能使用 @{

于 2017-05-19T07:53:46.723 回答
2

您可以尝试使用以下语法:

"temp": "\"test\": @{json(body('http'))['candidates'][0]['location']['x']}"
于 2017-05-19T06:13:03.073 回答