Concat string in JOLT - json

I am trying to contact two strings in JOLT. The fields are 'WG_REQ_FIRST_NAME + WG_REQ_LAST_NAME'.
What I want-
WG_REQ_FIRST_NAME - Tom
WG_REQ_LAST_NAME - Jones
requesterDetails- Tom Jones
Path at which I want the data - IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.poHeader.requesterDetails
What I tried-
{
"operation": "modify-overwrite-beta",
"spec": {
"requestorDetails": "=concat(#(1,WG_REQ_FIRST_NAME),' ',#(1,WG_REQ_LAST_NAME))"
}
}
I later then called the field but it is not showing in output-
"requestorDetails": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.poHeader.requesterDetails",
Input-
{
"PURCHASE_ORDER_DISPATCH": {
"MsgData": {
"Transaction": {
"PO_POD_HDR_EVW1": {
"WG_ADDR_SEQ_NUM": 1,
"WG_PO_CNTCT_EMAIL": "PeggyMeincke#westfieldgrp.com",
"WG_REQUESTOR_EMAIL": "ZacharyEngels#westfieldgrp.com",
"WG_REQ_FIRST_NAME": "Zachary",
"WG_REQ_LAST_NAME": "Engels",
"WG_DELIVER_TO": "ZacharyEngels#westfieldgrp.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": "OhioFarmersInsuranceCo",
"ADDRESS1_BU": "WESTFIELDCOMPANIES",
"ADDRESS2_BU": "HOMEOFFICE",
"ADDRESS3_BU": "1PARKCIRCLE",
"ADDRESS4_BU": "",
"CITY_BU": "WESTFIELDCENTER",
"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": "AMAZONCAPITALSERVICESINC",
"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": "ZacharyEngels",
"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": "147-1518156-3620845,1GreenMountainCoffeeRoastersCaramelVanillaCreamKeurigSingle-ServeK-CupPods,LightRoastCoffee,32Count",
"UNIT_OF_MEASURE": "EA",
"ITM_ID_VNDR": "B0798CX2Q9",
"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"
}
}
}
}
}
}
}
Spec-
[
{
"operation": "modify-overwrite-beta",
"spec": {
"requestorDetails": "=concat(#(1,WG_REQ_FIRST_NAME),' ',#(1,WG_REQ_LAST_NAME))"
}
},
{
"operation": "shift",
"spec": {
"#integrationTrackingNumber": "IntegrationEntities.integrationEntity.integrationEntityHeader.integrationTrackingNumber",
"#referenceCodeForEntity": "IntegrationEntities.integrationEntity.integrationEntityHeader.referenceCodeForEntity",
"#additionalInfo": "IntegrationEntities.integrationEntity.integrationEntityHeader.additionalInfo",
"*": {
"*": {
"*": {
"*": {
"PO_ID": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.externalId",
"#APPROVED": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.status",
"PO_AMT_TTL": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.poHeader.grossTotalAmount",
"#test.test\\#test.com": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.poHeader.checkoutBuyer.userEmailId",
"requestorDetails": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.poHeader.requesterDetails",
"FREIGHT_TERMS": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.poHeader.deliveryTermCode",
"WG_REQUESTOR_EMAIL": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.requesterDetails.userEmailId",
"WG_DELIVER_TO": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.deliverTo.userEmailId",
"#OFIC": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.poHeader.company.companyCode",
"BUSINESS_UNIT": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.poHeader.businessUnit.buCode",
"PYMNT_TERMS_CD": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.poHeader.paymentTermId",
"#1": [
"IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.poHeader.costingSplitLevel",
"IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.poHeader.costingSplitType"
],
"WG_ADDR_SEQ_NUM": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.poHeader.supplierAddress.addressERPID",
"CURRENCY_CD": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.poHeader.supplierCurrencyCode",
"#WG_ADDR_SEQ_NUM": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.poHeader.supplierAddressERPID",
"VENDOR_ID": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.poHeader.supplierERPID",
"WG_PO_CNTCT_EMAIL": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.poHeader.suppPOContactEmail",
"#2": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.poHeader.supplierPOContactType",
"WG_REQ_FIRST_NAME": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.requesterDetails.userFirstName",
"WG_REQ_LAST_NAME": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.requesterDetails.userLastName",
"#CURRENCY_CD": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.currency",
"#WG_DELIVER_TO": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.deliverToUser.userEmailId",
"*": {
"WG_REQ_ID": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.poHeader.poDescription",
"#STANDARD": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.poHeader.poType",
"LINE_NBR": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.lineNumber",
"WG_CATEGORY_CD": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.categoryCode",
"WG_ITEM_TYPE": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.itemType",
"MFG_ITM_ID": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.manufacturerPartID",
"ITM_ID_VNDR": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.supplierPartID",
"WG_ACCOUNT": {
"#": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.validCombinations.itemDetails.validRules.field[0].value",
"#name4": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.validCombinations.itemDetails.validRules.field[0].id",
"#AUTO_COMPLETE": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.validCombinations.itemDetails.validRules.field[0].type",
"#GL_ACCOUNT": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.validCombinations.itemDetails.validRules.field[0].name"
},
"WG_DEPT_ID": {
"#": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.validCombinations.itemDetails.validRules.field[1].value",
"#name3": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.validCombinations.itemDetails.validRules.field[1].id",
"#AUTO_COMPLETE": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.validCombinations.itemDetails.validRules.field[1].type",
"#Westfield Department": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.validCombinations.itemDetails.validRules.field[1].name"
},
"WG_PRODUCT": {
"#": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.validCombinations.itemDetails.validRules.field[2].value",
"#name6": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.validCombinations.itemDetails.validRules.field[2].id",
"#AUTO_COMPLETE": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.validCombinations.itemDetails.validRules.field[2].type",
"#Product/Parcel": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.validCombinations.itemDetails.validRules.field[2].name"
},
"WG_PROJECT": {
"#": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.validCombinations.itemDetails.validRules.field[3].value",
"#name5": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.validCombinations.itemDetails.validRules.field[3].id",
"#AUTO_COMPLETE": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.validCombinations.itemDetails.validRules.field[3].type",
"#Project Code": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.validCombinations.itemDetails.validRules.field[3].name"
},
"WG_ASSET_GROUP": {
"#": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.validCombinations.itemDetails.validRules.field[4].value",
"#name10": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.validCombinations.itemDetails.validRules.field[4].id",
"#AUTO_COMPLETE": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.validCombinations.itemDetails.validRules.field[4].type",
"#Asset Group": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.validCombinations.itemDetails.validRules.field[4].name"
},
"WG_CAPITALIZE": {
"#": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.validCombinations.itemDetails.validRules.field[5].value",
"#name9": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.validCombinations.itemDetails.validRules.field[5].id",
"#AUTO_COMPLETE": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.validCombinations.itemDetails.validRules.field[5].type",
"#Capitalize": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.validCombinations.itemDetails.validRules.field[5].name"
},
"WG_PROFILE_ID": {
"#": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.validCombinations.itemDetails.validRules.field[6].value",
"#name9": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.validCombinations.itemDetails.validRules.field[6].id",
"#AUTO_COMPLETE": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.validCombinations.itemDetails.validRules.field[6].type",
"#Profile Id": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.validCombinations.itemDetails.validRules.field[6].name"
},
"WG_ASSET_LOC": {
"#": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.validCombinations.itemDetails.validRules.field[7].value",
"#name2": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.validCombinations.itemDetails.validRules.field[7].id",
"#AUTO_COMPLETE": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.validCombinations.itemDetails.validRules.field[7].type",
"#Business Unit": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.validCombinations.itemDetails.validRules.field[7].name"
},
"BUSINESS_UNIT": {
"#": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.validCombinations.itemDetails.validRules.field[8].value",
"#name7": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.validCombinations.itemDetails.validRules.field[8].id",
"#AUTO_COMPLETE": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.validCombinations.itemDetails.validRules.field[8].type",
"#GL_ACCOUNT": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.validCombinations.itemDetails.validRules.field[8].name"
},
"*": {
"#WG_SHIP_ADDR_TYPE": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.poHeader.shipToAddressType",
"WG_SHIP_ADDR_TYPE": {
"2": {
"#(2,DESCR_SHIPTO)": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.poHeader.shipToAddress.addressName",
"#(2,ADDRESS1_SHIPTO)": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.poHeader.shipToAddress.addressLine1",
"#(2,ADDRESS2_SHIPTO)": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.poHeader.shipToAddress.addressLine2",
"#(2,ADDRESS3_SHIPTO)": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.poHeader.shipToAddress.addressLine3",
"#(2,ADDRESS4_SHIPTO)": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.poHeader.shipToAddress.addressLine4",
"#(2,CITY_SHIPTO)": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.poHeader.shipToAddress.city",
"#(2,POSTAL_SHIPTO)": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.poHeader.shipToAddress.zip",
"#(2,STATE_SHIPTO)": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.poHeader.shipToAddress.state",
"#(2,COUNTRY_SHIPTO)": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.poHeader.shipToAddress.country"
}
},
"WG_CUST_ADDR_CODE": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.poHeader.shipToAddress.addressCode",
"FREIGHT_TERMS": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.poHeader.deliveryTermCode",
"SHIPTO_ID": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.poHeader.locationCode.location.locationCode",
"DUE_DT": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.poHeader.deliverOn",
"#DUE_DT": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.deliveryOn",
"PRICE_PO": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.marketPrice",
"QTY_PO": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.itemQuantity",
"#WG_CUST_ADDR_CODE": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.shipToAddressCode",
"#WG_SHIP_ADDR_TYPE": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.shipToAddressType",
"#1": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.costingSplitType",
"#WG_CUST_ADDR_CODE": {
"2": {
"#(2,DESCR_SHIPTO)": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.shipToAddress.addressName",
"#(2,ADDRESS1_SHIPTO)": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.shipToAddress.addressLine1",
"#(2,ADDRESS2_SHIPTO)": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.shipToAddress.addressLine2",
"#(2,ADDRESS3_SHIPTO)": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.shipToAddress.addressLine3",
"#(2,ADDRESS4_SHIPTO)": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.shipToAddress.addressLine4",
"#(2,CITY_SHIPTO)": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.shipToAddress.city",
"#(2,POSTAL_SHIPTO)": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.shipToAddress.zip",
"#(2,STATE_SHIPTO)": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.shipToAddress.state",
"#(2,COUNTRY_SHIPTO)": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.shipToAddress.country"
}
}
}
}
}
}
}
}
}
}
]

You can use this spec:
[
{
"operation": "modify-overwrite-beta",
"spec": {
"*": {
"*": {
"*": {
"*": {
"requestorDetails": "=concat(#(1,WG_REQ_FIRST_NAME),' ',#(1,WG_REQ_LAST_NAME))"
}
}
}
}
}
},
{
"operation": "shift",
"spec": {
"#integrationTrackingNumber": "IntegrationEntities.integrationEntity.integrationEntityHeader.integrationTrackingNumber",
"#referenceCodeForEntity": "IntegrationEntities.integrationEntity.integrationEntityHeader.referenceCodeForEntity",
"#additionalInfo": "IntegrationEntities.integrationEntity.integrationEntityHeader.additionalInfo",
"*": {
"*": {
"*": {
"*": {
"requestorDetails": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.poHeader.requesterDetails",
"PO_ID": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.externalId",
"#APPROVED": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.status",
"PO_AMT_TTL": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.poHeader.grossTotalAmount",
"#test.test\\#test.com": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.poHeader.checkoutBuyer.userEmailId",
"requestorDetails": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.poHeader.requesterDetails",
"FREIGHT_TERMS": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.poHeader.deliveryTermCode",
"WG_REQUESTOR_EMAIL": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.requesterDetails.userEmailId",
"WG_DELIVER_TO": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.deliverTo.userEmailId",
"#OFIC": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.poHeader.company.companyCode",
"BUSINESS_UNIT": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.poHeader.businessUnit.buCode",
"PYMNT_TERMS_CD": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.poHeader.paymentTermId",
"#1": [
"IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.poHeader.costingSplitLevel",
"IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.poHeader.costingSplitType"
],
"WG_ADDR_SEQ_NUM": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.poHeader.supplierAddress.addressERPID",
"CURRENCY_CD": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.poHeader.supplierCurrencyCode",
"#WG_ADDR_SEQ_NUM": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.poHeader.supplierAddressERPID",
"VENDOR_ID": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.poHeader.supplierERPID",
"WG_PO_CNTCT_EMAIL": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.poHeader.suppPOContactEmail",
"#2": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.poHeader.supplierPOContactType",
"WG_REQ_FIRST_NAME": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.requesterDetails.userFirstName",
"WG_REQ_LAST_NAME": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.requesterDetails.userLastName",
"#CURRENCY_CD": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.currency",
"#WG_DELIVER_TO": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.deliverToUser.userEmailId",
"*": {
"WG_REQ_ID": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.poHeader.poDescription",
"#STANDARD": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.poHeader.poType",
"LINE_NBR": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.lineNumber",
"WG_CATEGORY_CD": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.categoryCode",
"WG_ITEM_TYPE": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.itemType",
"MFG_ITM_ID": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.manufacturerPartID",
"ITM_ID_VNDR": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.supplierPartID",
"WG_ACCOUNT": {
"#": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.validCombinations.itemDetails.validRules.field[0].value",
"#name4": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.validCombinations.itemDetails.validRules.field[0].id",
"#AUTO_COMPLETE": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.validCombinations.itemDetails.validRules.field[0].type",
"#GL_ACCOUNT": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.validCombinations.itemDetails.validRules.field[0].name"
},
"WG_DEPT_ID": {
"#": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.validCombinations.itemDetails.validRules.field[1].value",
"#name3": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.validCombinations.itemDetails.validRules.field[1].id",
"#AUTO_COMPLETE": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.validCombinations.itemDetails.validRules.field[1].type",
"#Westfield Department": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.validCombinations.itemDetails.validRules.field[1].name"
},
"WG_PRODUCT": {
"#": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.validCombinations.itemDetails.validRules.field[2].value",
"#name6": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.validCombinations.itemDetails.validRules.field[2].id",
"#AUTO_COMPLETE": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.validCombinations.itemDetails.validRules.field[2].type",
"#Product/Parcel": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.validCombinations.itemDetails.validRules.field[2].name"
},
"WG_PROJECT": {
"#": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.validCombinations.itemDetails.validRules.field[3].value",
"#name5": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.validCombinations.itemDetails.validRules.field[3].id",
"#AUTO_COMPLETE": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.validCombinations.itemDetails.validRules.field[3].type",
"#Project Code": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.validCombinations.itemDetails.validRules.field[3].name"
},
"WG_ASSET_GROUP": {
"#": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.validCombinations.itemDetails.validRules.field[4].value",
"#name10": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.validCombinations.itemDetails.validRules.field[4].id",
"#AUTO_COMPLETE": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.validCombinations.itemDetails.validRules.field[4].type",
"#Asset Group": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.validCombinations.itemDetails.validRules.field[4].name"
},
"WG_CAPITALIZE": {
"#": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.validCombinations.itemDetails.validRules.field[5].value",
"#name9": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.validCombinations.itemDetails.validRules.field[5].id",
"#AUTO_COMPLETE": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.validCombinations.itemDetails.validRules.field[5].type",
"#Capitalize": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.validCombinations.itemDetails.validRules.field[5].name"
},
"WG_PROFILE_ID": {
"#": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.validCombinations.itemDetails.validRules.field[6].value",
"#name9": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.validCombinations.itemDetails.validRules.field[6].id",
"#AUTO_COMPLETE": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.validCombinations.itemDetails.validRules.field[6].type",
"#Profile Id": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.validCombinations.itemDetails.validRules.field[6].name"
},
"WG_ASSET_LOC": {
"#": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.validCombinations.itemDetails.validRules.field[7].value",
"#name2": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.validCombinations.itemDetails.validRules.field[7].id",
"#AUTO_COMPLETE": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.validCombinations.itemDetails.validRules.field[7].type",
"#Business Unit": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.validCombinations.itemDetails.validRules.field[7].name"
},
"BUSINESS_UNIT": {
"#": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.validCombinations.itemDetails.validRules.field[8].value",
"#name7": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.validCombinations.itemDetails.validRules.field[8].id",
"#AUTO_COMPLETE": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.validCombinations.itemDetails.validRules.field[8].type",
"#GL_ACCOUNT": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.validCombinations.itemDetails.validRules.field[8].name"
},
"*": {
"#WG_SHIP_ADDR_TYPE": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.poHeader.shipToAddressType",
"WG_SHIP_ADDR_TYPE": {
"2": {
"#(2,DESCR_SHIPTO)": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.poHeader.shipToAddress.addressName",
"#(2,ADDRESS1_SHIPTO)": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.poHeader.shipToAddress.addressLine1",
"#(2,ADDRESS2_SHIPTO)": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.poHeader.shipToAddress.addressLine2",
"#(2,ADDRESS3_SHIPTO)": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.poHeader.shipToAddress.addressLine3",
"#(2,ADDRESS4_SHIPTO)": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.poHeader.shipToAddress.addressLine4",
"#(2,CITY_SHIPTO)": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.poHeader.shipToAddress.city",
"#(2,POSTAL_SHIPTO)": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.poHeader.shipToAddress.zip",
"#(2,STATE_SHIPTO)": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.poHeader.shipToAddress.state",
"#(2,COUNTRY_SHIPTO)": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.poHeader.shipToAddress.country"
}
},
"WG_CUST_ADDR_CODE": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.poHeader.shipToAddress.addressCode",
"FREIGHT_TERMS": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.poHeader.deliveryTermCode",
"SHIPTO_ID": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.poHeader.locationCode.location.locationCode",
"DUE_DT": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.poHeader.deliverOn",
"#DUE_DT": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.deliveryOn",
"PRICE_PO": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.marketPrice",
"QTY_PO": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.itemQuantity",
"#WG_CUST_ADDR_CODE": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.shipToAddressCode",
"#WG_SHIP_ADDR_TYPE": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.shipToAddressType",
"#1": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.costingSplitType",
"#WG_CUST_ADDR_CODE": {
"2": {
"#(2,DESCR_SHIPTO)": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.shipToAddress.addressName",
"#(2,ADDRESS1_SHIPTO)": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.shipToAddress.addressLine1",
"#(2,ADDRESS2_SHIPTO)": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.shipToAddress.addressLine2",
"#(2,ADDRESS3_SHIPTO)": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.shipToAddress.addressLine3",
"#(2,ADDRESS4_SHIPTO)": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.shipToAddress.addressLine4",
"#(2,CITY_SHIPTO)": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.shipToAddress.city",
"#(2,POSTAL_SHIPTO)": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.shipToAddress.zip",
"#(2,STATE_SHIPTO)": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.shipToAddress.state",
"#(2,COUNTRY_SHIPTO)": "IntegrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.shipToAddress.country"
}
}
}
}
}
}
}
}
}
}
]

Related

Flatten a complex nested JSON using jolt transform

I am facing a problem, transforming a very complex nested JSON using jolt transformation. Input and output detail is given below.
Input JSON
{
"OutboundSchedulingLT": {
"DepertureSite": "0DE1",
"ShippingPoint": "010D",
"LeadTimes": {
"TransportationLT": [
{
"DestinationSite": "0DEA",
"DestinationLT": [
{
"ShippingCondition": "01",
"DestinationSiteLT": "3"
},
{
"ShippingCondition": "02",
"DestinationSiteLT": "4"
},
{
"ShippingCondition": "OA",
"DestinationSiteLT": "2"
}
]
},
{
"DestinationSite": "0DEB",
"DestinationLT": [
{
"ShippingCondition": "01",
"DestinationSiteLT": "1"
},
{
"ShippingCondition": "02",
"DestinationSiteLT": "2"
},
{
"ShippingCondition": "OA",
"DestinationSiteLT": "3"
}
]
}
],
"DNCreationLeadTimes": {
"DNCreationLeadTime": [
{
"DistributionChannel": "40",
"OrderType": "ZFUT",
"OrderReason": "",
"DNCreationLT": "3"
},
{
"DistributionChannel": "40",
"OrderType": "ZOR",
"OrderReason": "",
"DNCreationLT": "3"
},
{
"DistributionChannel": "70",
"OrderType": "ZU20",
"OrderReason": "RDC",
"DNCreationLT": "1"
}
]
},
"DNProcessingLeadTimes": {
"DNProcessingLeadTime": [
{
"DistributionChannel": "40",
"OrderType": "ZFUT",
"OrderReason": "",
"DNprocessingLT": "2"
},
{
"DistributionChannel": "40",
"OrderType": "ZOR",
"OrderReason": "",
"DNprocessingLT": "4"
},
{
"DistributionChannel": "70",
"OrderType": "ZU20",
"OrderReason": "RDC",
"DNprocessingLT": "3"
}
]
},
"DNLoadingLeadTimes": {
"DNLoadingLeadTime": [
{
"DistributionChannel": "40",
"ShippingCondition": "O1",
"OrderType": "ZFUT",
"OrderReason": "",
"DNLoadingLT": "3"
},
{
"DistributionChannel": "40",
"ShippingCondition": "O1",
"OrderType": "ZOR",
"OrderReason": "",
"DNLoadingLT": "3"
},
{
"DistributionChannel": "70",
"ShippingCondition": "O1",
"OrderType": "ZU20",
"OrderReason": "RDC",
"DNLoadingLT": "1"
}
]
},
"VASLeadTimes": {
"VASLeadTime": [
{
"VASCode": "L01",
"VASLT": "2"
},
{
"VASCode": "P02",
"VASLT": "3"
}
]
}
}
}
}
I want the below columns in flattened way
DepertureSite,DestinationSite,DestinationSiteLT,DistributionChannel,OrderType,OrderReason,DNCreationLT,DNprocessingLT,DNLoadingLT,VASCode,VASLT
Jolt Spec I tried
[
{
"operation": "shift",
"spec": {
"OutboundSchedulingLT": {
"DepertureSite": "DepertureSite",
"LeadTimes": {
"TransportationLT": {
"*": {
"DestinationSite": "DestinationSite",
"DestinationLT": {
"*": {
"DestinationSiteLT": "DestinationSiteLT"
}
}
}
},
"DNCreationLeadTimes": {
"DNCreationLeadTime": {
"*": {
"DistributionChannel": "DistributionChannel",
"OrderType": "OrderType",
"OrderReason": "OrderReason",
"DNCreationLT": "DNCreationLT"
}
}
},
"DNProcessingLeadTimes": {
"DNProcessingLeadTime": {
"*": {
"DNprocessingLT": "DNprocessingLT"
}
}
},
"DNLoadingLeadTimes": {
"DNLoadingLeadTime": {
"*": {
"DNLoadingLT": "DNLoadingLT"
}
}
},
"VASLeadTimes": {
"VASLeadTime": {
"*": {
"VASCode": "VASCode",
"VASLT": "VASLT"
}
}
}
}
}
}
}
]
But its not coming as expected.
Pls help
Output Expected
[
{
"DepertureSite": "0DE1",
"DestinationSite": "0DEA",
"DestinationSiteLT": "3",
"DistributionChannel": "40",
"OrderType": "ZOR",
"OrderReason": "",
"DNCreationLT": "3",
"DNprocessingLT": "2",
"DNLoadingLT": "3",
"VASCode": "L01",
"VASLT": "2"
},
{
"DepertureSite": "0DE1",
"DestinationSite": "0DEA",
"DestinationSiteLT": "4",
"DistributionChannel": "70",
"OrderType": "ZU20",
"OrderReason": "RDC",
"DNprocessingLT": "4",
"DNLoadingLT": "3",
"VASCode": "L01",
"VASLT": "2"
},
{
"DepertureSite": "0DE1",
"DestinationSite": "0DEA",
"DestinationSiteLT": "2",
"DistributionChannel": "70",
"OrderType": "ZU20",
"OrderReason": "RDC",
"DNCreationLT": "1",
"DNprocessingLT": "3",
"DNLoadingLT": "1",
"VASCode": "L01",
"VASLT": "2"
},
{
"DepertureSite": "0DE1",
"DestinationSite": "0DEB",
"DestinationSiteLT": "1",
"DistributionChannel": "40",
"OrderType": "ZOR",
"OrderReason": "",
"DNCreationLT": "3",
"DNprocessingLT": "2",
"DNLoadingLT": "3",
"VASCode": "P02",
"VASLT": "3"
},
{
"DepertureSite": "0DE1",
"DestinationSite": "0DEB",
"DestinationSiteLT": "2",
"DistributionChannel": "70",
"OrderType": "ZU20",
"OrderReason": "RDC",
"DNprocessingLT": "4",
"DNLoadingLT": "3",
"VASCode": "P02",
"VASLT": "3"
},
{
"DepertureSite": "0DE1",
"DestinationSite": "0DEB",
"DestinationSiteLT": "3",
"DistributionChannel": "70",
"OrderType": "ZU20",
"OrderReason": "RDC",
"DNCreationLT": "1",
"DNprocessingLT": "3",
"DNLoadingLT": "1",
"VASCode": "P02",
"VASLT": "3"
}
]
You can use the following shift transformation as walking through the DestinationLT object spec
[
{
"operation": "shift",
"spec": {
"OutboundSchedulingLT": {
"LeadTimes": {
"TransportationLT": {
"*": {
"DestinationLT": {
"*": {
"#5,DepertureSite": "&3[#2].DepertureSite",
"#2,DestinationSite": "&3[#2].DestinationSite",
"DestinationSiteLT": "&3[#2].&",
"#4,DNCreationLeadTimes.DNCreationLeadTime[&].DistributionChannel": "&3[#2].DistributionChannel",
"#4,DNCreationLeadTimes.DNCreationLeadTime[&].OrderType": "&3[#2].OrderType",
"#4,DNCreationLeadTimes.DNCreationLeadTime[&].OrderReason": "&3[#2].OrderReason",
"#4,DNCreationLeadTimes.DNCreationLeadTime[&].DNCreationLT": "&3[#2].DNCreationLT",
"#4,DNProcessingLeadTimes.DNCreationLeadTime[&].DNProcessingLeadTime": "&3[#2].DNprocessingLT",
"#4,DNLoadingLeadTimes.DNLoadingLeadTime[&].DNLoadingLT": "&3[#2].DNLoadingLT",
"#4,VASLeadTimes.VASLeadTime[&].VASCode": "&3[#2].VASCode",
"#4,VASLeadTimes.VASLeadTime[&].VASLT": "&3[#2].VASLT"
}
}
}
}
}
}
}
},
{// get rid of the object keys generated within the previous spec
"operation": "shift",
"spec": {
"*": {
"*": ""
}
}
}
]

Convert Flat JSON to Nested JSON with arrays

I am facing a problem, transforming flat JSON to the nested JSON using jolt transformation. And I am very new to jolt Transformation. Input and output detail is given below.
My input
[
{
"ProposalId": "1234",
"ReplStrategy": "External",
"CreatedDate": "2022-10-26",
"ValidFromDate": "2022-10-26",
"DeliveryDate": "2022-10-29",
"InventLocationIdFrom": "10",
"InventLocationIdTo": "12",
"RetailVariantId": "123457",
"Qty": 12
},
{
"ProposalId": "1234",
"ReplStrategy": "External",
"CreatedDate": "2022-10-26",
"ValidFromDate": "2022-10-26",
"DeliveryDate": "2022-10-29",
"InventLocationIdFrom": "10",
"InventLocationIdTo": "12",
"RetailVariantId": "123458",
"Qty": 16
},
{
"ProposalId": "1235",
"ReplStrategy": "External",
"CreatedDate": "2022-10-26",
"ValidFromDate": "2022-10-26",
"DeliveryDate": "2022-10-29",
"InventLocationIdFrom": "10",
"InventLocationIdTo": "12",
"RetailVariantId": "123459",
"Qty": 12
},
{
"ProposalId": "1235",
"ReplStrategy": "External",
"CreatedDate": "2022-10-26",
"ValidFromDate": "2022-10-26",
"DeliveryDate": "2022-10-29",
"InventLocationIdFrom": "10",
"InventLocationIdTo": "12",
"RetailVariantId": "123460",
"Qty": 16
},
{
"ProposalId": "1235",
"ReplStrategy": "External",
"CreatedDate": "2022-10-26",
"ValidFromDate": "2022-10-26",
"DeliveryDate": "2022-10-29",
"InventLocationIdFrom": "10",
"InventLocationIdTo": "12",
"RetailVariantId": "123461",
"Qty": 16
}
]
expected output
{
"Proposal": [
{
"ProposalId": "1234",
"ReplStrategy": "External",
"CreatedDate": "2022-10-26",
"ValidFromDate": "2022-10-26",
"DeliveryDate": "2022-10-29",
"InventLocationIdFrom": "10",
"InventLocationIdTo": "12",
"RetailVariant": [
{
"RetailVariantId": "123456",
"Qty": 15,
},
{
"RetailVariantId": "123457",
"Qty": 12,
}
]
},
{
"ProposalId": "1235",
"ReplStrategy": "TwoPhased",
"CreatedDate": "2022-10-26",
"ValidFromDate": "2022-10-26",
"DeliveryDate": "2022-10-29",
"InventLocationIdFrom": "10",
"InventLocationIdTo": "12",
"RetailVariant": [
{
"RetailVariantId": "123458",
"Qty": 13,
},
{
"RetailVariantId": "123459",
"Qty": 11,
}
]
}
]
}
I wrote jolt spec and I'm not getting the desired output
Jolt i used
[
{
"operation": "shift",
"spec": {
"*": {
"ProposalId": "#(1,ProposalId).Proposal.&",
"ReplStrategy": "#(1,ProposalId).Proposal.&",
"CreatedDate": "#(1,ProposalId).Proposal.&",
"ValidFromDate": "#(1,ProposalId).Proposal.&",
"DeliveryDate": "#(1,ProposalId).Proposal.&",
"InventLocationIdFrom": "#(1,ProposalId).Proposal.&",
"InventLocationIdTo": "#(1,ProposalId).Proposal.&",
"*": "#(1,ProposalId).Proposal.RetailVariant[&1].&"
}
}
},
{
"operation": "modify-overwrite-beta",
"spec": {
"*": "=recursivelySquashNulls"
}
},
{
"operation": "cardinality",
"spec": {
"*": {
"*": {
"ProposalId": "ONE",
"ReplStrategy": "ONE",
"CreatedDate": "ONE",
"ValidFromDate": "ONE",
"DeliveryDate": "ONE",
"InventLocationIdFrom": "ONE",
"InventLocationIdTo": "ONE"
}
}
}
},
{
"operation": "shift",
"spec": {
"*": ""
}
}
]
Can anyone who is a jolt expert, help me get the desired output. I think i m stuck in the last step
You can use
[
{ // group by ProposalId values
"operation": "shift",
"spec": {
"*": {
"*": "#(1,ProposalId).&",
"RetailVariantId|Qty": {
"#": "#(2,ProposalId).RetailVariant[&2].&"
}
}
}
},
{ // nest all JSON value within Proposal array
"operation": "shift",
"spec": {
"*": "Proposal[]"
}
},
{
"operation": "cardinality",
"spec": {
"*": {
"*": {
"*": "ONE",
"RetailVariant": "MANY"
}
}
}
},
{ // get rid of redundant nulls
"operation": "modify-overwrite-beta",
"spec": {
"*": "=recursivelySquashNulls"
}
}
]
the demo on the site http://jolt-demo.appspot.com/ is

JOLT transformation for carrying parent fields to child

I trying to apply JOLT transformation to convert one JSON structure into another. The JOLT spec I came up with does not distribute parent fields to child as I want and is explained in the example below. Could you please help with the mistake I'm doing in the spec?
My input JSON
{
"numberOfBlocks": 2,
"signatoryBlocks": [
{
"block": [
{
"role": "abcd"
},
{
"order": "1"
},
{
"signatureProviderName": "universalsignaturepen_opentrust_hash_tsp"
},
{
"signatories": [
{
"email": "joe.smith#abcd.com",
"name": "Joe Smith",
"initials": "JS",
"capacity": "Authorised Signatory",
"company": "abcd AG",
"oneTimePassword": "test_joe",
"sms": "1234"
},
{
"email": "jane.doe#abcd.com",
"name": "Jane Doe",
"initials": "JD",
"capacity": "Director",
"company": "abcd AG",
"oneTimePassword": "test_jane",
"sms": "4567"
}
]
}
]
},
{
"block": [
{
"role": "Signer 2"
},
{
"order": "1"
},
{
"signatureProviderName": "universalsignaturepen_opentrust_hash_tsp"
},
{
"signatories": [
{
"email": "rachel.smith#abcd.com",
"name": "Rachel Smith",
"initials": "RS",
"capacity": "Authorised Signatory",
"company": "abcd AG",
"oneTimePassword": "test_rachel",
"sms": ""
},
{
"email": "joe.bloggs#abcd.com",
"name": "Joe Bloggs",
"initials": "JB",
"capacity": "Authorised Signatory",
"company": "abcd AG",
"oneTimePassword": "test_joe",
"sms": "111"
}
]
}
]
}
]
}
My JOLT spec
[
{
"operation": "shift",
"spec": {
"#3186": "entityId",
"#160": "entityTypeId",
"#1007": "clientId",
"*": ["rawData.&0", "formatedData.&0"]
}
},
{
"operation": "shift",
"spec": {
"*": "&0",
"formatedData": {
"signatoryBlocks": {
"*": {
"block": {
"3": {
"signatories": {
"*": {
"#3": {
"0": {
"role": "formatedData.[#8].roleGroupName"
},
"1": {
"order": "formatedData.[#8].order"
},
"2": {
"signatureProviderName": "formatedData.[#8].signatureProviderName"
}
},
"*": "formatedData.[#6].userDetails[#2].&0"
}
}
}
}
}
}
}
}
},
{
"operation": "cardinality",
"spec": {
"formatedData": {
"*": {
"roleGroupName": "ONE",
"order": "ONE",
"signatureProviderName": "ONE"
}
}
}
}
]
Output I am getting using my JOLT spec
{
"entityId": "3186",
"entityTypeId": "160",
"clientId": "1007",
"rawData": {
"numberOfBlocks": 2,
"signatoryBlocks": [
{
"block": [
{
"role": "abcd"
},
{
"order": "1"
},
{
"signatureProviderName": "universalsignaturepen_opentrust_hash_tsp"
},
{
"signatories": [
{
"email": "joe.smith#abcd.com",
"name": "Joe Smith",
"initials": "JS",
"capacity": "Authorised Signatory",
"company": "abcd AG",
"oneTimePassword": "test_joe",
"sms": "1234"
},
{
"email": "jane.doe#abcd.com",
"name": "Jane Doe",
"initials": "JD",
"capacity": "Director",
"company": "abcd AG",
"oneTimePassword": "test_jane",
"sms": "4567"
}
]
}
]
},
{
"block": [
{
"role": "Signer 2"
},
{
"order": "1"
},
{
"signatureProviderName": "universalsignaturepen_opentrust_hash_tsp"
},
{
"signatories": [
{
"email": "rachel.smith#abcd.com",
"name": "Rachel Smith",
"initials": "RS",
"capacity": "Authorised Signatory",
"company": "abcd AG",
"oneTimePassword": "test_rachel",
"sms": ""
},
{
"email": "joe.bloggs#abcd.com",
"name": "Joe Bloggs",
"initials": "JB",
"capacity": "Authorised Signatory",
"company": "abcd AG",
"oneTimePassword": "test_joe",
"sms": "111"
}
]
}
]
}
]
},
"formatedData": [
{
"roleGroupName": "abcd",
"order": "1",
"signatureProviderName": "universalsignaturepen_opentrust_hash_tsp",
"userDetails": [
{
"email": "joe.smith#abcd.com",
"name": "Joe Smith",
"initials": "JS",
"capacity": "Authorised Signatory",
"company": "abcd AG",
"oneTimePassword": "test_joe",
"sms": "1234"
},
{
"email": "jane.doe#abcd.com",
"name": "Jane Doe",
"initials": "JD",
"capacity": "Director",
"company": "abcd AG",
"oneTimePassword": "test_jane",
"sms": "4567"
}
]
},
{
"roleGroupName": "Signer 2",
"order": "1",
"signatureProviderName": "universalsignaturepen_opentrust_hash_tsp",
"userDetails": [
{
"email": "rachel.smith#abcd.com",
"name": "Rachel Smith",
"initials": "RS",
"capacity": "Authorised Signatory",
"company": "abcd AG",
"oneTimePassword": "test_rachel",
"sms": ""
},
{
"email": "joe.bloggs#abcd.com",
"name": "Joe Bloggs",
"initials": "JB",
"capacity": "Authorised Signatory",
"company": "abcd AG",
"oneTimePassword": "test_joe",
"sms": "111"
}
]
}
]
}
Output I want
{
"entityId": 3186,
"entityTypeId": 160,
"clientId": 1007,
"rawData": "complete_body_of_input_JSON_here",
"formatedData": [
{
"roleGroupName": "abcd",
"order": "1",
"signatureProvider": "universalsignaturepen_opentrust_hash_tsp",
"userDetails": [
{
"email": "joe.smith#abcd.com",
"name": "Joe Smith",
"initials": "JS",
"capacity": "Authorised Signatory",
"company": "abcd AG",
"oneTimePassword": "test_joe",
"sms": "1234"
}
]
},
{
"roleGroupName": "abcd",
"order": "1",
"signatureProvider": "universalsignaturepen_opentrust_hash_tsp",
"userDetails": [
{
"email": "jane.doe#abcd.com",
"name": "Jane Doe",
"initials": "JD",
"capacity": "Director",
"company": "abcd AG",
"oneTimePassword": "test_jane",
"sms": "4567"
}
]
},
{
"roleGroupName": "Signer 2",
"order": "1",
"signatureProvider": "universalsignaturepen_opentrust_hash_tsp",
"userDetails": [
{
"email": "rachel.smith#abcd.com",
"name": "Rachel Smith",
"initials": "RS",
"capacity": "Authorised Signatory",
"company": "abcd AG",
"oneTimePassword": "test_rachel",
"sms": ""
}
]
},
{
"roleGroupName": "Signer 2",
"order": "1",
"signatureProvider": "universalsignaturepen_opentrust_hash_tsp",
"userDetails": [
{
"email": "joe.bloggs#abcd.com",
"name": "Joe Bloggs",
"initials": "JB",
"capacity": "Authorised Signatory",
"company": "abcd AG",
"oneTimePassword": "test_joe",
"sms": "111"
}
]
}
]
}
What am I doing wrong?
Here is the answer
[
{
"operation": "shift",
"spec": {
"#3186": "entityId",
"#160": "entityTypeId",
"#1007": "clientId",
"*": ["rawData.&0","formatedData.&0"]
}
},
{
"operation": "shift",
"spec": {
"*": "&0",
"formatedData": {
"signatoryBlocks": {
"*": {
"block": {
"3": {
"signatories": {
"*": {
"#3": {
"0": {
"role": "formatedData.[#8].[#6].[#4].roleGroupName"
},
"1": {
"order": "formatedData.[#8].[#6].[#4].order"
},
"2": {
"signatureProviderName": "formatedData.[#8].[#6].[#4].signatureProviderName"
}
},
"*": "formatedData.[#6].[#4].[#2].userDetails.&0"
}
}
}
}
}
}
}
}
},
{
"operation": "modify-overwrite-beta",
"spec": {
"entityId": "=toInteger",
"entityTypeId": "=toInteger",
"clientId": "=toInteger"
}
},
{
"operation": "shift",
"spec": {
"*": "&0",
"formatedData": {
"*": {
"*": {
"*": "formatedData"
}
}
}
}
}
]

need Jolt Spec to convent JSON array key name to updated name

Original JSON message:
[
{
"correlationId": "12345",
"payloadFormat": "Money",
"payload": {
"stateName": "TX",
"location": "south",
"name": "Dallas",
"pop": "2M"
}
},
{
"correlationId": "ed1e3",
"payloadFormat": "Cash",
"payload": {
"stateName": "CA",
"location": "west",
"name": "LosAngeles",
"pop": "4M"
}
}
]
Output should be in below format:
[
{
"correlationId": "12345",
"payloadFormat": "Money",
"payload": {
"California": "TX",
"MontGomery": "south",
"City": "Dallas",
"ID": "2M"
}
},
{
"correlationId": "ed1e3",
"payloadFormat": "Cash",
"payload": {
"California": "CA",
"MontGomery": "west",
"City": "LosAngeles",
"ID": "4M"
}
}
]
Check this spec,
[
{
"operation": "shift",
"spec": {
"*": {
"correlationId": "[&1].correlationId",
"payloadFormat": "[&1].payloadFormat",
"payload": {
"stateName": "[&2].payload.California",
"location": "[&2].payload.MontGomery",
"name": "[&2].payload.City",
"pop": "[&2].payload.ID"
}
}
}
}
]

Getting local json data with reactjs

I'm getting json error in my first reactjs work. It is very important for me and work which I am a candidate. How can I fix this? Thank u very much.
related class:
constructor() {
super();
this.state = {
data:[],
}
}
componentDidMount(){
fetch('../JsonFiles/routes.json').
then(response => response.json()).
then(findresponse => this.setState ({ data: findresponse.data }));
}
render() {
return (
<div>
fasfasfa
{
this.state.data.map((dynamicData, key) =>
<div>
<span> {dynamicData.routes.origin.cityName} </span>
<span> {dynamicData.routes.destinations[{}].cityName} </span>
</div>
)
}
</div>
);
}
}
json file:
{"routes": [
{
"origin": {
"name": "Aalborg Airport",
"country": "DK",
"cityName": "Aalborg",
"cityCode": "AAL"
},
"destinations": [
{
"name": "Bornholm Rønne",
"country": "DK",
"cityName": "Bornholm",
"cityCode": "RNN"
}
]
},
{
"origin": {
"name": "Barca",
"country": "ES",
"cityName": "Barcelona",
"cityCode": "BCN"
},
"destinations": [
{
"name": "Borispol",
"country": "UA",
"cityName": "Kyiv",
"cityCode": "KBP"
}
]
},
{
"origin": {
"name": "Billund",
"country": "DK",
"cityName": "Billund",
"cityCode": "BLL"
},
"destinations": [
{
"name": "Bornholm Rønne",
"country": "DK",
"cityName": "Bornholm",
"cityCode": "RNN"
},
{
"name": "København Kastrup",
"country": "DK",
"cityName": "Copenhagen",
"cityCode": "CPH"
},
{
"name": "Stavanger Sola",
"country": "NO",
"cityName": "Stavanger",
"cityCode": "SVG"
}
]
},
{
"origin": {
"name": "Bornholm Rønne",
"country": "DK",
"cityName": "Bornholm",
"cityCode": "RNN"
},
"destinations": [
{
"name": "Aalborg Airport",
"country": "DK",
"cityName": "Aalborg",
"cityCode": "AAL"
},
{
"name": "Billund",
"country": "DK",
"cityName": "Billund",
"cityCode": "BLL"
},
{
"name": "København Kastrup",
"country": "DK",
"cityName": "Copenhagen",
"cityCode": "CPH"
},
{
"name": "Midtjyllands Lufthavn (Karup)",
"country": "DK",
"cityName": "Midtjyllands Lufthavn (Karup)",
"cityCode": "KRP"
},
{
"name": "Stavanger Sola",
"country": "NO",
"cityName": "Stavanger",
"cityCode": "SVG"
}
]
},
{
"origin": {
"name": "Charles de Gaulle",
"country": "FR",
"cityName": "Charles de Gaulle",
"cityCode": "CDG"
},
"destinations": [
{
"name": "Billund",
"country": "DK",
"cityName": "Billund",
"cityCode": "BLL"
}
]
},
{
"origin": {
"name": "København Kastrup",
"country": "DK",
"cityName": "Copenhagen",
"cityCode": "CPH"
},
"destinations": [
{
"name": "Billund",
"country": "DK",
"cityName": "Billund",
"cityCode": "BLL"
},
{
"name": "Bornholm Rønne",
"country": "DK",
"cityName": "Bornholm",
"cityCode": "RNN"
},
{
"name": "Midtjyllands Lufthavn (Karup)",
"country": "DK",
"cityName": "Midtjyllands Lufthavn (Karup)",
"cityCode": "KRP"
}
]
},
{
"origin": {
"name": "Esbjerg",
"country": "DK",
"cityName": "Esbjerg",
"cityCode": "EBJ"
},
"destinations": [
{
"name": "Stavanger Sola",
"country": "NO",
"cityName": "Stavanger",
"cityCode": "SVG"
}
]
},
{
"origin": {
"name": "Borispol",
"country": "UA",
"cityName": "Kyiv",
"cityCode": "KBP"
},
"destinations": [
{
"name": "Barca",
"country": "ES",
"cityName": "Barcelona",
"cityCode": "BCN"
}
]
},
{
"origin": {
"name": "Midtjyllands Lufthavn (Karup)",
"country": "DK",
"cityName": "Midtjyllands Lufthavn (Karup)",
"cityCode": "KRP"
},
"destinations": [
{
"name": "Bornholm Rønne",
"country": "DK",
"cityName": "Bornholm",
"cityCode": "RNN"
},
{
"name": "København Kastrup",
"country": "DK",
"cityName": "Copenhagen",
"cityCode": "CPH"
}
]
},
{
"origin": {
"name": "Oslo Gardermoen",
"country": "NO",
"cityName": "Oslo",
"cityCode": "OSL"
},
"destinations": [
{
"name": "Stord lufthavn, Sørstokken",
"country": "NO",
"cityName": "Stord",
"cityCode": "SRP"
},
{
"name": "Ørland",
"country": "NO",
"cityName": "Ørland",
"cityCode": "OLA"
}
]
},
{
"origin": {
"name": "Rhodos",
"country": "GR",
"cityName": "Rhodos",
"cityCode": "RHO"
},
"destinations": [
{
"name": "Billund",
"country": "DK",
"cityName": "Billund",
"cityCode": "BLL"
}
]
},
{
"origin": {
"name": "Stavanger Sola",
"country": "NO",
"cityName": "Stavanger",
"cityCode": "SVG"
},
"destinations": [
{
"name": "Billund",
"country": "DK",
"cityName": "Billund",
"cityCode": "BLL"
},
{
"name": "Bornholm Rønne",
"country": "DK",
"cityName": "Bornholm",
"cityCode": "RNN"
},
{
"name": "Esbjerg",
"country": "DK",
"cityName": "Esbjerg",
"cityCode": "EBJ"
}
]
},
{
"origin": {
"name": "Stord lufthavn, Sørstokken",
"country": "NO",
"cityName": "Stord",
"cityCode": "SRP"
},
"destinations": [
{
"name": "Oslo Gardermoen",
"country": "NO",
"cityName": "Oslo",
"cityCode": "OSL"
}
]
},
{
"origin": {
"name": "Ørland",
"country": "NO",
"cityName": "Ørland",
"cityCode": "OLA"
},
"destinations": [
{
"name": "Oslo Gardermoen",
"country": "NO",
"cityName": "Oslo",
"cityCode": "OSL"
}
]
}
]}
AND I AM GETTING THIS ERROR:
I AM GETTING THIS ERROR
1
Unhandled Rejection (SyntaxError): Unexpected token < in JSON at position 0
(anonymous function)
D:/development/js-projects/material-tutorial/src/Components/TrialForm/FlightSearch.js:13
10 |
11 | componentDidMount(){
12 | fetch('../JsonFiles/routes.json').
13 | then(response => response.json()).
14 | then(findresponse => this.setState ({ data: findresponse.data }));
15 |
16 |
You can import JSON file.
import * as jsonFile from '../JsonFiles/routes.json';
Define it on state in constructor function:
constructor() {
super();
this.state = {
data: jsonFile
}
}
es2015 version:
import jsonFile from '../JsonFiles/routes.json';
Now you have all json data available in "jsonFile" and you can use it any where.