Logic Apps-使用嵌套数组从JSON提取值 [英] Logic Apps - extract value from JSON with nested arrays

查看:76
本文介绍了Logic Apps-使用嵌套数组从JSON提取值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个带有2个嵌套数组的JSON文件.

We have a JSON file with 2 nested arrays inside.

JSON示例:

{
    "BusinesUnitId":"f174b943-b9ac-e811-a967-000d3ab204d5",
    "CorrelationId":"68a54dbb-3700-462a-8674-ab493746ee8c",
    "PostEntityImages":[
       {
                                      " key":"account",
                                      值":{
属性":[
{
              b " key":"customertypecode",
              b 值":{
              b ;    " __type":" OptionSetValue:http://schemas.microsoft.com/xrm/2011/Contracts" ;,
              b ;    值":285030000
               b }
              },
              {
" key":"address2_addresstypecode",
值":{
;    " __type":" OptionSetValue:http://schemas.microsoft.com/xrm/2011/Contracts" ;,
              b&b ;    值":1
}
              },
              {
键":合并",
值":false
              },
              {
  " key":"accountnumber",
  值":"ACC-01003-8ECV5E"
              }
.....

{
    "BusinesUnitId": "f174b943-b9ac-e811-a967-000d3ab204d5",
    "CorrelationId": "68a54dbb-3700-462a-8674-ab493746ee8c",   
    "PostEntityImages": [
        {
            "key": "account",
            "value": {
                "Attributes": [
                    {
                        "key": "customertypecode",
                        "value": {
                            "__type": "OptionSetValue:http://schemas.microsoft.com/xrm/2011/Contracts",
                            "Value": 285030000
                        }
                    },
                    {
                        "key": "address2_addresstypecode",
                        "value": {
                            "__type": "OptionSetValue:http://schemas.microsoft.com/xrm/2011/Contracts",
                            "Value": 1
                        }
                    },
                    {
                        "key": "merged",
                        "value": false
                    },
                    {
                        "key": "accountnumber",
                        "value": "ACC-01003-8ECV5E"
                    }
.....

但是不幸的是,我们无法提取帐号值.

But unfortunately we fail to extract the accountnumber value.

我们尝试了以下语句,但没有得到任何结果.

We tried the following statement, but don't get any result.

"@ body('Compose')?['PostEntityImages']?[0]?['value']?['Attributes']?[3]?['value']'"

"@body('Compose')?['PostEntityImages']?[0]?['value']?['Attributes']?[3]?['value']"

推荐答案

HI,

我能够通过以下表达式获取值

I was able to get the value with the below expression

@triggerBody()?['PostEntityImages'][0]?['value']?['Attributes'][3]?['value']

检入您的作文,您将按预期获得正确的Json

Check in your compose you are getting the correct Json as expected


这篇关于Logic Apps-使用嵌套数组从JSON提取值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆