You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

请求提供JOLT转换规则:多数组结构转指定格式

JOLT转换规范

以下是满足需求的JOLT转换规则:

[
  {
    "operation": "shift",
    "spec": {
      "EBody": {
        "ServiceDetails": {
          "LineDetail": {
            "LineNumber": {
              "0": "EBody.ServiceDetails.LinesDetail[0].LineNumber",
              "1": "EBody.ServiceDetails.LinesDetail[1].LineNumber"
            },
            "Amount": {
              "0": "EBody.ServiceDetails.LinesDetail[0].Quantity",
              "1": "EBody.ServiceDetails.LinesDetail[1].Quantity"
            },
            "Unit price": {
              "0": "EBody.ServiceDetails.LinesDetail[0].Unit Price",
              "1": "EBody.ServiceDetails.LinesDetail[1].Unit Price"
            },
            "VAT Rate": "EBody.ServiceDetails.LinesDetail[1].VAT Rate",
            "SurchargeDiscount": "EBody.ServiceDetails.LinesDetail[1].SurchargeDiscount"
          }
        }
      }
    }
  }
]

规则说明:

  • 通过shift操作完成字段映射与结构重组
  • 将LineDetail下的数组元素按索引对应到LinesDetail数组的两个对象中
  • 把原字段Amount重命名为Quantity,Unit price重命名为Unit Price
  • 将VAT Rate和SurchargeDiscount直接关联到第二条明细记录

内容的提问来源于stack exchange,提问作者SATHK

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.08 20:21:15