Created 09-20-2025 06:15 AM
Experts,
Provide me jolt transform for my json input shown below
Input json would be like below. This is just one record. Actually there can be multiple records
{
"Product": "4039",
"Plant": "1010",
"MRPArea": "",
"PlndIndepRqmtType": "VSE",
"PlndIndepRqmtVersion": "00",
"RequirementPlan": "",
"RequirementSegment": "",
"PlndIndepRqmtIsActive": "X",
"PlndIndepRqmtPeriod": "20250502",
"NoWithdrawal": "",
"DeleteOld": "",
"PeriodType": "2",
"PlannedQuantity": "20.000",
"UnitOfMeasure": "PC",
"ProductionVersion": ""
}
Output what i am expecting as below
{
"Product": "4039",
"Plant": "1010",
"MRPArea": "",
"PlndIndepRqmtType": "VSE",
"PlndIndepRqmtVersion": "00",
"RequirementPlan": "",
"RequirementSegment": "",
"PlndIndepRqmtIsActive": "X",
"PlndIndepRqmtPeriod": "20250502",
"NoWithdrawal": "",
"DeleteOld": "",
"to_PlndIndepRqmtItem": [
{
"Product": "4039",
"Plant": "1010",
"MRPArea": "",
"PlndIndepRqmtType": "VSE",
"PlndIndepRqmtVersion": "00",
"RequirementPlan": "",
"RequirementSegment": "",
"PlndIndepRqmtPeriod": "20250502",
"PeriodType": "2",
"PlannedQuantity": "20.000",
"UnitOfMeasure": "PC",
"ProductionVersion": ""
}
]
}
"to_PlndIndepRqmtItem" array has some duplicate fileds from header.
Created 09-22-2025 06:37 AM
@Kumar1243
Try using the following spec:
[
{
"operation": "shift",
"spec": {
"Product": [
"Product",
"to_PlndIndepRqmtItem[0].Product"
],
"Plant": [
"Plant",
"to_PlndIndepRqmtItem[0].Plant"
],
"MRPArea": [
"MRPArea",
"to_PlndIndepRqmtItem[0].MRPArea"
],
"PlndIndepRqmtType": [
"PlndIndepRqmtType",
"to_PlndIndepRqmtItem[0].PlndIndepRqmtType"
],
"PlndIndepRqmtVersion": [
"PlndIndepRqmtVersion",
"to_PlndIndepRqmtItem[0].PlndIndepRqmtVersion"
],
"RequirementPlan": [
"RequirementPlan",
"to_PlndIndepRqmtItem[0].RequirementPlan"
],
"RequirementSegment": [
"RequirementSegment",
"to_PlndIndepRqmtItem[0].RequirementSegment"
],
"PlndIndepRqmtPeriod": [
"PlndIndepRqmtPeriod",
"to_PlndIndepRqmtItem[0].PlndIndepRqmtPeriod"
],
"PlndIndepRqmtIsActive": "PlndIndepRqmtIsActive",
"NoWithdrawal": "NoWithdrawal",
"DeleteOld": "DeleteOld",
"PeriodType": "to_PlndIndepRqmtItem[0].PeriodType",
"PlannedQuantity": "to_PlndIndepRqmtItem[0].PlannedQuantity",
"UnitOfMeasure": "to_PlndIndepRqmtItem[0].UnitOfMeasure",
"ProductionVersion": "to_PlndIndepRqmtItem[0].ProductionVersion"
}
}
]
You can use the JoltTransformRecord or JoltTransformJson processors. The JoltTransfromRecord will allow you to define a schema for your multi-record input FlowFiles. The JoltTransformJson processor would require you to split you source FlowFile first so you have one record per FlowFile.
Hope this helps you get closer to success,.
Please help our community grow. If you found any of the suggestions/solutions provided helped you with solving your issue or answering your question, please take a moment to login and click "Accept as Solution" on one or more of them that helped.
Thank you,
Matt
Created 09-22-2025 06:37 AM
@Kumar1243
Try using the following spec:
[
{
"operation": "shift",
"spec": {
"Product": [
"Product",
"to_PlndIndepRqmtItem[0].Product"
],
"Plant": [
"Plant",
"to_PlndIndepRqmtItem[0].Plant"
],
"MRPArea": [
"MRPArea",
"to_PlndIndepRqmtItem[0].MRPArea"
],
"PlndIndepRqmtType": [
"PlndIndepRqmtType",
"to_PlndIndepRqmtItem[0].PlndIndepRqmtType"
],
"PlndIndepRqmtVersion": [
"PlndIndepRqmtVersion",
"to_PlndIndepRqmtItem[0].PlndIndepRqmtVersion"
],
"RequirementPlan": [
"RequirementPlan",
"to_PlndIndepRqmtItem[0].RequirementPlan"
],
"RequirementSegment": [
"RequirementSegment",
"to_PlndIndepRqmtItem[0].RequirementSegment"
],
"PlndIndepRqmtPeriod": [
"PlndIndepRqmtPeriod",
"to_PlndIndepRqmtItem[0].PlndIndepRqmtPeriod"
],
"PlndIndepRqmtIsActive": "PlndIndepRqmtIsActive",
"NoWithdrawal": "NoWithdrawal",
"DeleteOld": "DeleteOld",
"PeriodType": "to_PlndIndepRqmtItem[0].PeriodType",
"PlannedQuantity": "to_PlndIndepRqmtItem[0].PlannedQuantity",
"UnitOfMeasure": "to_PlndIndepRqmtItem[0].UnitOfMeasure",
"ProductionVersion": "to_PlndIndepRqmtItem[0].ProductionVersion"
}
}
]
You can use the JoltTransformRecord or JoltTransformJson processors. The JoltTransfromRecord will allow you to define a schema for your multi-record input FlowFiles. The JoltTransformJson processor would require you to split you source FlowFile first so you have one record per FlowFile.
Hope this helps you get closer to success,.
Please help our community grow. If you found any of the suggestions/solutions provided helped you with solving your issue or answering your question, please take a moment to login and click "Accept as Solution" on one or more of them that helped.
Thank you,
Matt