简体   繁体   English

JOLT 换档转换

[英]JOLT Shift transformation

Need JOLT spec for JSON input and output.PFB the data for same.需要 JSON 输入和 output.PFB 数据的 JOLT 规范。

Input :输入

{
  "customer": {
    "contact": {
      "name": {
        "firstName": "Karan",
        "lastName": "Singh",
        "middleName": null
      },
      "phone": "902-167-5435",
      "secondaryPhone": null,
      "email": "Karan.Singh@gmail.com"
    }
  }
}

Expected Output :预计 Output

{
  "buyerInfo": {
    "id": "as123-e617-4410-969f",
    "primaryContact": {
      "name": {
        "firstName": "Karan",
        "lastName": "Singh"
      },
      "phone": {
        "completeNumber": "9021675435"
      },
      "email": {
        "emailAddress": "Karan.Singh@gmail.com"
      }
    }
  }
}

Please help me out on providing the JOLT spec for same.请帮助我提供相同的 JOLT 规范。 Also please share JOLT links.也请分享 JOLT 链接。

[
  {
    "operation": "shift",
    "spec": {
      "customer": {
        "contact": {
          "name": {
            "firstName": "buyerInfo.primaryContact.name.firstName",
            "lastName": "buyerInfo.primaryContact.name.lastName"
          },
          "phone": "buyerInfo.primaryContact.phone.completeNumber",
          "email": "buyerInfo.primaryContact.email.emailAddress"
        }
      }
    }
  }
]

Got the JOLT Spec :) 得到了JOLT Spec :)

Think symbolically, write less through use of some wildcards such as * , & and # as in the following spec象征性地思考,通过使用一些通配符如*&#来减少写,如下面的规范

[
  {
    "operation": "shift",
    "spec": {
      "#as123-e617-4410-969f": "buyerInfo.id",
      "cu*": {
        "co*": {
          "name": {
            "*t*ame": "buyerInfo.primary&(2,0).&1.&"
          },
          "ph*": "buyerInfo.primarycontact.&.completeNumber",
          "em*": "buyerInfo.primarycontact.&.&Address"
        }
      }
    }
  }
]

The demo on the site http://jolt-demo.appspot.com/ is站点http://jolt-demo.appspot.com/上的演示

在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM