[英]Returning specific property (text) from JSON object file in azure logic apps
我不確定我是否嚴重搞砸了 JSON 文件,或者我是否遇到了我真正誤解的東西。 下面是我的 JSON 架構。
這對我來說看起來不錯。 The problem is when I try to get a specific line out of the JSON to put in a automated email template, I get either nothing or the whole JSON output in one line. 這是我下面的工作流程,我嘗試使用variables('variable1')['0']或variables('variable1')['AP Outage Title'] 、過濾器數組等初始化變量。我是否初始化變量並將 JSON 文件的特定屬性放入該變量中? 我覺得我很接近但錯過了一些關鍵的東西。
我相信 JSON 是 JSON object,但我可能錯了。
除了構建 JSON Schema 之外,您還可以直接構建 JSON Schema,使用Use sample payload to generate schema
,然后粘貼您的 JSON。 這樣做會自動為您生成 JSON Schema。
步驟1:
第2步:
結果:
現在您可以使用 JSON 內的對象生成
下面是使用上述步驟生成的架構。
{
"properties": {
"body": {
"properties": {
"AP Outage Title": {
"properties": {
"0": {
"type": "string"
},
"1": {
"type": "string"
},
"2": {
"type": "string"
},
"3": {
"type": "string"
},
"4": {
"type": "string"
},
"5": {
"type": "string"
},
"6": {
"type": "string"
},
"7": {
"type": "string"
},
"8": {
"type": "string"
},
"9": {
"type": "string"
},
"10": {
"type": "string"
},
"11": {
"type": "string"
}
},
"type": "object"
},
"Revision Date": {
"properties": {
"0": {
"type": "string"
},
"1": {
"type": "string"
},
"2": {
"type": "string"
},
"3": {
"type": "string"
},
"4": {
"type": "string"
},
"5": {
"type": "string"
},
"6": {
"type": "string"
},
"7": {
"type": "string"
},
"8": {
"type": "string"
},
"9": {
"type": "string"
},
"11": {
"type": "string"
},
"18": {
"type": "string"
}
},
"type": "object"
}
},
"type": "object"
}
},
"type": "object"
}
或者,要通過表達式獲取值,您可以使用<Name_Of_The_Action_You_Are_Retrieving_The_Object>?['body']?['<Object_Name>']?['<String_Name>']
。
例子:
outputs('Compose')?['body']?['AP Outage Title']?['0']
下面是我的邏輯應用程序
結果:
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.