Skip to main content Skip to complementary content

Creating key/value pairs

In Talend Data Mapper, you can create structure elements with a Map group type to work with key/value pairs in your mappings.

About this task

In this example, you have an input JSON file with an items array that contains an object for each item. The goal of this transformation is to get an output JSON file with an items object that contains an object for each item with the item ID as the key. You can use the following JSON sample as input:
{
    "items": [
        {
            "id": "ABC123",
            "name": "MBIKE",
            "description": "27.5 inch electric mountain bike"
        },
        {
            "id": "DEF456",
            "name": "EBIKE",
            "description": "Electric hybrid bike"
        },
        {
            "id": "GHI789",
            "name": "WBIKE",
            "description": "Women's road bike"
        }
    ]
}

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – please let us know!