Supplier catalogs

How to choose material from a JSON attributes array

2026-06-29
Task

Product characteristics are stored in a JSON attributes array: material, color, and other parameters. The import needs a separate material field.

Short answer

Open value inside attributes and add a condition on neighboring code: regular expression ^material$ (matches a value that is exactly material).

How to do it in Eofferix

  1. In the JSON snapshot, select value inside the repeated block.

    JSON field value
    The selected field belongs to one repeated object.
  2. Open the value settings.

    Opening value settings
    The animation shows opening the field settings.
  3. Add an export condition: code ^material$.

    JSON condition
    The condition selects only the needed object before export.

Before / after

Before

source data
{
    "products": [
        {
            "sku": "SKU-14001",
            "name": "Hudson lamp",
            "attributes": [
                {
                    "code": "material",
                    "name": "Material",
                    "value": "steel"
                },
                {
                    "code": "color",
                    "name": "Color",
                    "value": "white"
                }
            ]
        },
        {
            "sku": "SKU-14002",
            "name": "Parker chair",
            "attributes": [
                {
                    "code": "material",
                    "name": "Material",
                    "value": "wood"
                },
                {
                    "code": "color",
                    "name": "Color",
                    "value": "black"
                }
            ]
        }
    ]
}

After

result
{
    "products": [
        {
            "sku": "SKU-14001",
            "name": "Hudson lamp",
            "material": "steel"
        },
        {
            "sku": "SKU-14002",
            "name": "Parker chair",
            "material": "wood"
        }
    ]
}

What to keep in mind

  • The condition must check code from the same attribute, otherwise color can be taken instead of material.
  • If the supplier uses attribute_id instead of code, use that path in the condition.

Process data faster with Eofferix

Create a free account to automate catalogs and price lists around your own rules.

Sign up