簡體   English   中英

無法使用 Jolt (V0.1.1) 將 Json 數組轉換為扁平化 Json

[英]Not able to Convert Array of Json to Flattern Json Using Jolt (V0.1.1)

輸入有效載荷:

{
  "accountNo":112233,
  "type":"DEDICATED",
  "Plans" : {
     "One":"Basic",
     "Two":"Mid",
     "Three":"Premium"  
   },

  "Address": {
     "Primary":{
       "Addressline1":" road 1, boss lane",
      "AddressLine2": "ST",
    "City":"Tex"
    }
  }

}

預期有效載荷:

{
  "accountNo":112233,
  "type":"DEDICATED",
  "One":"Basic",
  "Two":"Mid",
  "Three":"Premium",
  "Addressline1":" road 1, boss lane",
  "AddressLine2": "ST",
  "City":"Tex"
}

使用 Jolt v0.1.1 無法轉換,誰能幫幫我

檢查這個規格,

[
  {
    "operation": "shift",
    "spec": {
      "accountNo": "accountNo",
      "type": "type",
      "Plans": {
        "One": "One",
        "Two": "Two",
        "Three": "Three"
      },
      "Address": {
        "Primary": {
          "Addressline1": "Addressline1",
          "AddressLine2": "AddressLine2",
          "City": "City"
        }
      }
    }
  }
]

您可以通過分離到PlansAddress.Primary*的條件分支來單獨評估表達式,以用於移位轉換中的其余(非嵌套)元素,例如

[
  {
    "operation": "shift",
    "spec": {
      "Plans": {
        "*": "&"
      },
      "Address": {
        "Primary": {
          "*": "&"
        }
      },
      "*": {
        "@": "&"
      }
    }
  }
]

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM