Supplier catalogs

How to choose the leaf category from a JSON categories array

2026-06-29
Task

Each product has a JSON categories array with levels 1, 2, and 3. The import needs the third-level leaf category.

Short answer

Open name inside categories and add a condition on neighboring level: regular expression ^3$ (matches a value that is exactly 3).

How to do it in Eofferix

  1. In the JSON snapshot, select name inside the categories array.

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

    Opening name settings
    The animation shows opening the field settings.
  3. Method 1: on neighboring level, set Equals 3.

    JSON condition
    This is one condition variant; the other variants do not need to be added.
  4. Method 2: keep regular expression ^3$ (matches a value that is exactly 3) as the strict option.

    JSON condition
    This is one condition variant; the other variants do not need to be added.

Before / after

Before

source data
{
    "products": [
        {
            "sku": "SKU-20001",
            "name": "Hudson lamp",
            "categories": [
                {
                    "level": 1,
                    "name": "Lighting"
                },
                {
                    "level": 2,
                    "name": "Table lamps"
                },
                {
                    "level": 3,
                    "name": "LED lamps"
                }
            ]
        },
        {
            "sku": "SKU-20002",
            "name": "Parker chair",
            "categories": [
                {
                    "level": 1,
                    "name": "Lighting"
                },
                {
                    "level": 2,
                    "name": "Table lamps"
                }
            ]
        }
    ]
}

After

result
{
    "products": [
        {
            "sku": "SKU-20001",
            "name": "Hudson lamp",
            "category": "LED lamps"
        },
        {
            "sku": "SKU-20002",
            "name": "Parker chair",
            "category": null
        }
    ]
}

Process data faster with Eofferix

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

Sign up