获取正确的网址

问题描述 投票:0回答:1
[
  {
    "domain-specific-features": {
      "features": [
        {
          "id": 3581,
          "name": "search-hello"
        },
        {
          "id": 3582,
          "name": "search-rmn"
        },
        {
          "id": 3864,
          "name": "search-email"
        },
        {
          "id": 3865,
          "name": "search-sr"
        },
        {
          "id": 3866,
          "name": "search-order"
        },
        {
          "id": 3867,
          "name": "search-disconnected-customer"
        },
        {
          "id": 3868,
          "name": "search-customer-id"
        },
        {
          "id": 3869,
          "name": "search-customer-number"
        }
      ]
    }
  },
  {
    "input": {
      "mobile-number": "1234567890",
      "pattern": "search"
    }
  }
]
this is the input

[ { “操作”:“转移”,“规范”:{ “*”:{ “特定于域的功能”:{ “结果状态”:“结果状态”,“功能”:{ “*”:“移动性\ -callerId\-featureList[].feature" } }, "input": "input" } } }, { "operation": "shift", "spec": { "resultStatus": "resultStatus", "mobility\- callerId\-featureList": { "*": { "@(2,input)": { "mobile-number": "mobility\-callerId\-featureList[&2].mobileNumber", "pattern": "mobility\ -callerId\-featureList[&2].pattern" }, "*": "mobility\-callerId\-featureList[&1].&" } } } }, { "操作": "修改覆盖测试版", "规格": { "mobility\-call*rId\-featureList": { "*": { "feature*ure": { "mobility\-callerId\-featureList\-url": "=concat('/epsp-模式/',@(2,模式),'/',@(1,姓名),'?', '手机号码=', @(2,手机号码), '&appPatternFeatureId=', @(1,id ))" } } } } }, { "operation": "shift", "spec": { "resultStatus": { "#NO_RECORD": "resultStatus.status", "#未找到记录": "resultStatus.message ", "#7000": "resultStatus.code" }, "mobility\-callerId\-featureList": { "*": { "feature": { "mobility\-callerId\-featureList\-url": "mobility \-callerId\-featureList[&2].&" } } } } } ] 这是我尝试过的震动,并且正在数组中获取网址。我也想把它放在列表中

json concatenation jolt
1个回答
0
投票

您可以再次改变输出以获得所需的输出:

[
  {
    "operation": "shift",
    "spec": {
      "*": { //matches the top-level key (mobility-callerId-featureList)
        "*": { //matches each object within the array
          "*": "&" //matches each key-value pair within the nested objects.
    //'&' to keep the value and place it directly under the top-level key
        }
      }
    }
  }
]

所以你的整个 Jolt 就变成了这样:

[
  {
    "operation": "shift",
    "spec": {
      "*": {
        "domain-specific-features": {
          "resultStatus": "resultStatus",
          "features": {
            "*": "mobility\\-callerId\\-featureList[].feature"
          }
        },
        "input": "input"
      }
    }
    },
  {
    "operation": "shift",
    "spec": {
      "resultStatus": "resultStatus",
      "mobility\\-callerId\\-featureList": {
        "*": {
          "@(2,input)": {
            "mobile-number": "mobility\\-callerId\\-featureList[&2].mobileNumber",
            "pattern": "mobility\\-callerId\\-featureList[&2].pattern"
          },
          "*": "mobility\\-callerId\\-featureList[&1].&"
        }
      }
    }
    },
  {
    "operation": "modify-overwrite-beta",
    "spec": {
      "mobility\\-call*rId\\-featureList": {
        "*": {
          "fea*ure": {
            "mobility\\-callerId\\-featureList\\-url": "=concat('/epsp-pattern/',@(2,pattern),'/',@(1,name),'?', 'mobile-number=', @(2,mobileNumber), '&appPatternFeatureId=', @(1,id))"
          }
        }
      }
    }
    },
  {
    "operation": "shift",
    "spec": {
      "resultStatus": {
        "#NO_RECORD": "resultStatus.status",
        "#No records found": "resultStatus.message",
        "#7000": "resultStatus.code"
      },
      "mobility\\-callerId\\-featureList": {
        "*": {
          "feature": {
            "mobility\\-callerId\\-featureList\\-url": "mobility\\-callerId\\-featureList[&2].&"
          }
        }
      }
    }
    },
  {
    "operation": "shift",
    "spec": {
      "*": {
        "*": {
          "*": "&"
        }
      }
    }
  }
]

© www.soinside.com 2019 - 2024. All rights reserved.