{
"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"
}
}
它将"temp"读作"test":@json(body('http'((['candidates'][0]['location']['x']">
如果我将此行更改为
"temp": "@json(body('http'))['candidates'][0]['location']['x']"
它从 json 读取正确的值。不确定这是一个错误,还是我缺少一些语法。
试试史蒂文的回答(https://stackoverflow.com/a/44062649/7997843(或者对我来说更明确的回答:
"temp": "@concat('"test":', json(body('http'))['candidates'][0]['location']['x'])"
我建议您在此处阅读有关工作流定义语言中的字符串内插的信息:https://learn.microsoft.com/en-us/azure/logic-apps/logic-apps-workflow-definition-language#Expressions
您的案例似乎是一个限制案例。要么以@
ou @{
开头表达式,然后以函数名称开头,要么以字符串开头,但随后别无选择,只能使用@{
你能试试下面的语法吗:
"temp": ""test": @{json(body('http'))['candidates'][0]['location']['x']}"