Transform multi level JSON message to multi level JSON Output and generate a file output

Four Stars

Transform multi level JSON message to multi level JSON Output and generate a file output

I need to create a map between multi level json input file and transform using map source json format to json format and generate a multi level output json file as mentioned below.

 

Sample input : 

Order.json

 

{
"Order":
{
"@Banner": "ABCD",
"@OrderID": "123456",
"@OrderNo": "890",
"OrderLine":
[
{
"OrderedQty":"1",
"ItemID":"ITEM01",
"UnitOfMeasure":"EACH",
"ProductClass":"GOOD"
},
{
"OrderedQty":"2",
"ItemID":"ITEM02",
"UnitOfMeasure":"EACH",
"ProductClass":"MEDIUM"
}
]
}
}

 

Sample JSON output expected :

PurchaseOrder.json

<PurchaseOrder>
<PurchaseBanner></PurchaseBanner>
<PurchaseOrderID></PurchaseOrderID>
<PurchaseOrderNo></PurchaseOrderNo>
<POLines>
<POLine>
<OrderedQty></OrderedQty>
<ItemID></ItemID>
<UOM></UOM>
<ProductClass></ProductClass>
</POLine>
<POLine>
<OrderedQty></OrderedQty>
<ItemID></ItemID>
<UOM></UOM>
<ProductClass></ProductClass>
</POLine>
</POLines>
</PurchaseOrder>

 

Four Stars

Re: Transform multi level JSON message to multi level JSON Output and generate a file output

I managed to get it working using approach mentioned below.

 

tFileInputJson --> tWriteJsonField --> tFileOutputRaw

 

Note : I am using tFileOutputRaw instead of tFileOutputJson as i am already parsing the data in tWriteJsonField.

 

Any comment of better practice to improve my solution and maping the same is much appreciated.

Tutorial

Introduction to Talend Open Studio for Data Integration.

Definitive Guide to Data Integration

Practical steps to developing your data integration strategy.

Definitive Guide to Data Quality

Create systems and workflow to manage clean data ingestion and data transformation.