json 在JOLT中传递默认值

hwazgwia  于 2022-11-26  发布在  其他
关注(0)|答案(2)|浏览(146)

我尝试在JOLT中传递默认值。传递时,我在数组中多次获取默认值。我尝试使用“”作为基数,但仍然出错。
我试过-
":基数规范中的“ONE”。
下面是输入,规格和输出ss。任何想法如何解决这个。如果任何更多的信息是必要的,然后请让我知道。

输入-

{
  "PURCHASE_ORDER_DISPATCH": {
    "MsgData": {
      "Transaction": {
        "PO_POD_HDR_EVW1": {
          "WG_ADDR_SEQ_NUM": 1,
          "WG_PO_CNTCT_EMAIL": "dwevc@xyzgrp.com",
          "WG_REQUESTOR_EMAIL": "ddds@xyzgrp.com",
          "WG_REQ_FIRST_NAME": "addy",
          "WG_REQ_LAST_NAME": "Easdls",
          "WG_DELIVER_TO": "asdee@xyzgrp.com",
          "BUSINESS_UNIT": "OFIC",
          "PO_ID": 25052,
          "VENDOR_SETID": "WCOS",
          "VENDOR_ID": 35958,
          "VNDR_LOC": 1,
          "PO_DT": "2020-01-24",
          "DB_NUMBER_BU": "",
          "DESCR_BU": "asdddsuranceCo",
          "ADDRESS1_BU": "xyzCOMPANIES",
          "ADDRESS2_BU": "HOMEOsdFFIsdCE",
          "ADDRESS3_BU": "1PsddARKCIsdRddsdCLE",
          "ADDRESS4_BU": "",
          "CITY_BU": "xyzCENTER",
          "STATE_BU": "OH",
          "POSTAL_BU": "44251-5001",
          "COUNTRY_BU": "USA",
          "ADDRESS1_BILL": "",
          "ADDRESS2_BILL": "",
          "ADDRESS3_BILL": "",
          "ADDRESS4_BILL": "",
          "CITY_BILL": "",
          "STATE_BILL": "",
          "POSTAL_BILL": "",
          "COUNTRY_BILL": "",
          "CURRENCY_CD": "USD",
          "TAX_EXEMPT_ID": "",
          "STD_ID_NUM_VNDR": "",
          "NAME1_VNDR": "asdsdsd",
          "ADDRESS1_VNDR": "410TERRYAVEN",
          "ADDRESS2_VNDR": "",
          "ADDRESS3_VNDR": "",
          "ADDRESS4_VNDR": "",
          "CITY_VNDR": "SEATTLE",
          "STATE_VNDR": "WA",
          "POSTAL_VNDR": 98109,
          "COUNTRY_VNDR": "USA",
          "PYMNT_TERMS_CD": "NET30",
          "DESCR50_PAY": "Net30",
          "BUYER_ID": 1083,
          "PO_AMT_TTL": 14.99,
          "TEXT254_CC1": "",
          "TEXT254_CC2": "",
          "VNDR_UPN_FLG": "N",
          "STD_ID_NUM_VNDRGLN": "",
          "STD_ID_NUM_BILLTO": "",
          "ATTN_TO": "asdsdsd",
          "PO_POD_LN_EVW1": {
            "WG_REQ_ID": 25694,
            "WG_CATEGORY_CD": "FSSUP",
            "WG_ITEM_TYPE": 0,
            "WG_ACCOUNT": 641100,
            "WG_DEPT_ID": 30400,
            "WG_PRODUCT": "",
            "BUSINESS_UNIT": "OFIC",
            "PO_ID": 25052,
            "WG_ASSET_GROUP": "",
            "WG_CAPITALIZE": "NO",
            "WG_PROFILE_ID": "",
            "WG_SPLIT_TYPE": 1,
            "WG_ASSET_LOC": "HOME",
            "WG_PROJECT": "",
            "VENDOR_SETID": "WCOS",
            "VENDOR_ID": 35958,
            "VNDR_LOC": 1,
            "LINE_NBR": 1,
            "INV_ITEM_ID": "",
            "DESCR254_MIXED": "sdasdadspPods,LightRoastCoffee,32Count",
            "UNIT_OF_MEASURE": "EA",
            "ITM_ID_VNDR": "B0798CX2Q9",
            "INV_ITEM_WEIGHT": 0,
            "INV_ITEM_HEIGHT": 0,
            "INV_ITEM_VOLUME": 0,
            "INV_ITEM_LENGTH": 0,
            "INV_ITEM_WIDTH": 0,
            "VNDR_CATALOG_ID": "",
            "MFG_ID": "",
            "MFG_ITM_ID": 5000196305,
            "CNTRCT_ID": "",
            "VERSION_NBR": 0,
            "CNTRCT_LINE_NBR": 0,
            "CAT_LINE_NBR": 0,
            "RELEASE_NBR": 0,
            "CANCEL_STATUS": "A",
            "UPN_ID": "",
            "PO_POD_SHP_EVW1": {
              "WG_SHIP_ADDR_TYPE": 0,
              "WG_CUST_ADDR_CODE": "OFIC",
              "BUSINESS_UNIT": "OFIC",
              "PO_ID": 25052,
              "VENDOR_SETID": "WCOS",
              "VENDOR_ID": 35958,
              "VNDR_LOC": 1,
              "LINE_NBR": 1,
              "SCHED_NBR": 1,
              "DUE_DT": "2020-01-29",
              "SHIPTO_ID": "OFIC",
              "DESCR_SHIPTO": "asdasddOMPANY",
              "ADDRESS1_SHIPTO": "asdsdsdCOMPANY",
              "ADDRESS2_SHIPTO": "1PARKCIRCLE",
              "ADDRESS3_SHIPTO": "POBOX5001",
              "ADDRESS4_SHIPTO": "",
              "CITY_SHIPTO": "xyzCENTER",
              "STATE_SHIPTO": "OH",
              "POSTAL_SHIPTO": "44251-5001",
              "COUNTRY_SHIPTO": "USA",
              "PRICE_PO": 14.99,
              "FREIGHT_TERMS": "FOBDEST",
              "QTY_PO": 1,
              "SHIP_TYPE_ID": "BEST_WAY",
              "CANCEL_STATUS": "A",
              "ATTN_TO": "",
              "STD_ID_NUM_SHIPTO": ""
            },
            "PSCAMA": {
              "AUDIT_ACTN": "A"
            }
          },
          "PSCAMA": {
            "AUDIT_ACTN": "A"
          }
        },
        "PSCAMA": {
          "LANGUAGE_CD": "ENG",
          "AUDIT_ACTN": "A",
          "BASE_LANGUAGE_CD": "ENG",
          "MSG_SEQ_FLG": "",
          "PROCESS_INSTANCE": 1199010,
          "PUBLISH_RULE_ID": "WG_MAIN_RULE",
          "MSGNODENAME": ""
        }
      }
    }
  }
}

规格

[
  {
    "operation": "shift",
    "spec": {
      "#UPSERT": "integration-inbound:IntegrationDetails.integrationEntities.integrationEntity.integrationEntityHeader.action",
      "*": {
        "*": {
          "*": {
            "*": {
              "PO_ID": "integration-inbound:IntegrationDetails.integrationEntities.integrationEntity.integrationEntityDetails.poDetails.externalId",
              "#APPROVED": "integration-inbound:IntegrationDetails.integrationEntities.integrationEntity.integrationEntityDetails.poDetails.status",
              "*": {
                "WG_REQ_ID": "integration-inbound:IntegrationDetails.integrationEntities.integrationEntity.integrationEntityDetails.poDetails.poHeader.poDescription",
                "#STANDARD": "integration-inbound:IntegrationDetails.integrationEntities.integrationEntity.integrationEntityDetails.poDetails.poHeader.poType",
                "*": {
                  "FREIGHT_TERMS": "integration-inbound:IntegrationDetails.integrationEntities.integrationEntity.integrationEntityDetails.poDetails.poHeader.deliveryTermCode"
                }
              }
            }
          }
        }
      }
    }
  },
  {
    "operation": "shift",
    "spec": {
      "*": {
        "*": {
          "*": {
            "integrationEntityHeader": "&3.&2.&1.&",
            "integrationEntityDetails": {
              "*": {
                "externalId": "&5.&4.&3.&2.&1.&",
                "status": "&5.&4.&3.&2.&1.&",
                "poHeader": "&5.&4.&3.&2.&1.&"
              }
            }
          }
        }
      }
    }
  },
  {
    "operation": "cardinality",
    "spec": {
      "*": {
        "*": {
          "*": {
            "*": {
              "*": {
                "*": "ONE"
              }
            }
          }
        }
      }
    }
  }
]

输出-

brccelvz

brccelvz1#

在添加了缺失的星号之后,您应该确定标识符"ONE"的确切位置。(例如,* 分隔大小写 *)
在这种情况下,请考虑将以下规范使用到当前规范的末尾

[
....,
  {
    "operation": "cardinality",
    "spec": {
      "*": {
        "*": {
          "*": {
            "integrationEntityDetails": {
              "*": {
                "*": "ONE"
              }
            }
          }
        }
      }
    }
  }
]

由于标记为"integrationEntityHeader"的对象的深度不等于(小于)标记为"integrationEntityDetails"的对象,因此出现错误
因此,您也可以考虑使用

,
  {
    "operation": "cardinality",
    "spec": {
      "*": {
        "*": {
          "*": {
            "integrationEntityHeader": {
              "*": "ONE"
            },
            "integrationEntityDetails": {
              "*": {
                "*": "ONE"
              }
            }
          }
        }
      }
    }
  }
]

包括两种情况(* 如果需要 *)

pkln4tw6

pkln4tw62#

根据您的输入,您的cardinality是错误的。请测试此规格。

[
  {
    "operation": "shift",
    "spec": {
      "#UPSERT": "integration-inbound:IntegrationDetails.integrationEntities.integrationEntity.integrationEntityHeader.action",
      "*": {
        "*": {
          "*": {
            "*": {
              "PO_ID": "integration-inbound:IntegrationDetails.integrationEntities.integrationEntity.integrationEntityDetails.poDetails.externalId",
              "#APPROVED": "integration-inbound:IntegrationDetails.integrationEntities.integrationEntity.integrationEntityDetails.poDetails.status",
              "*": {
                "WG_REQ_ID": "integration-inbound:IntegrationDetails.integrationEntities.integrationEntity.integrationEntityDetails.poDetails.poHeader.poDescription",
                "#STANDARD": "integration-inbound:IntegrationDetails.integrationEntities.integrationEntity.integrationEntityDetails.poDetails.poHeader.poType",
                "*": {
                  "FREIGHT_TERMS": "integration-inbound:IntegrationDetails.integrationEntities.integrationEntity.integrationEntityDetails.poDetails.poHeader.deliveryTermCode"
                }
              }
            }
          }
        }
      }
    }
  },
  {
    "operation": "shift",
    "spec": {
      "*": {
        "*": {
          "*": {
            "integrationEntityHeader": "&3.&2.&1.&",
            "integrationEntityDetails": {
              "*": {
                "externalId": "&5.&4.&3.&2.&1.&",
                "status": "&5.&4.&3.&2.&1.&",
                "poHeader": "&5.&4.&3.&2.&1.&"
              }
            }
          }
        }
      }
    }
  },
  {
    "operation": "cardinality",
    "spec": {
      "*": {
        "*": {
          "*": {
            "*": {
              "*": {
                "status": "ONE",
                "poHeader": {
                  "*": "ONE"
                }
              }
            }
          }
        }
      }
    }
  }
]

相关问题