Forum Discussion

neelamanikandan's avatar
neelamanikandan
New Contributor II
2 years ago

Json splitter for multiple array objects

I have a Json input that contains multiple array objects within it. Json sample given below. I'm trying to flatten this data into table rows, I use two json splitter to achieve this.

First Json splitter with Split path $ServiceCompanyArray and then a mapper to map the split value and then another Json splitter with split path $ServiceCompanyDetailArray and then another mapper to Writer.

Note: this is an xample Json, the actual Json could have multiple array fields, so should we always use N number of json splitters.

{
    "Vehicle_Id""_Id4",
    "InceptionDt""2023-08-03",
    "ServiceCompanyArray": [
        {
            "@_Id""_Id5",
            "$""ServiceCompany45"
        },
        {
            "@_Id""_Id6",
            "$""ServiceCompany47"
        }
    ],
    "ServiceCompanyDetailArray": [
        {
            "ServiceCompanyAddressLine1""ServiceCompanyAddressLine150",
            "ServiceCompanyPhone""ServiceCompanyPhone26",
            "ServiceCompanyPostalCode""ServiceCompanyPostalCode2"
        },
        {
            "ServiceCompanyAddressLine1""ServiceCompanyAddressLine163",
            "ServiceCompanyPhone""ServiceCompanyPhone9",
            "ServiceCompanyPostalCode""ServiceCompanyPostalCode15"
        }
    ]
}