0
votes

I need to transform below Input JSON to output JSON and not sure about how to write spec for that output. compare filed values in JOLT transformation

Here is the input:

{
"body": {
    "productConfigurations": [
        {
            "productConfiguration": {
                "selected": true,
                "productSpecification": {
                    "id": "1776911"
                },
                "productOffering": {
                    "id": "1777341"
                }
            }
        },
        {
            "productConfiguration": {
                "selected": true,
                "productSpecification": {
                    "id": "247541"
                },
                "productOffering": {
                    "id": "735501"
                }
            
        },
        {
            "productConfiguration": {
                "productSpecification": {
                    "id": "280801"
                },
                "productOffering": {
                    "id": "735501"
                }
            }
        }
    ]
}

}

expected output: I need to transform below Input JSON to output JSON and not sure about how to write spec for that output. compare filed values in JOLT transformation.

{
"body": [
    {
        "id": "1777341",
        "products": [
            {
                "id": "1776911"
            }
        ]
    },
    {
        "id": "735501",
        "products": [
            {
                "id": "247541"
            },
            {
                "id": "280801"
            }
        ]
    }
]

}