Supplier catalogs

How to take price from a JSON prices array by price_type

2026-06-29
Task

Each JSON product has a prices array: base and retail price. The import needs only the price with price_type=retail.

Short answer

Open amount inside prices and add a condition on neighboring price_type: regular expression ^retail$ (matches a value that is exactly retail).

How to do it in Eofferix

  1. In the JSON snapshot, select amount inside the prices array.

    JSON field amount
    The selected field belongs to one array item.
  2. Open the value settings.

    Opening amount settings
    The animation shows opening the field settings.
  3. Add an export condition: price_type ^retail$.

    JSON condition
    The condition selects the needed array item before exporting the value.

Before / after

Before

source data
{
    "products": [
        {
            "sku": "SKU-29001",
            "name": "Hudson lamp",
            "prices": [
                {
                    "price_type": "base",
                    "amount": 1490,
                    "currency": "USD"
                },
                {
                    "price_type": "retail",
                    "amount": 1290,
                    "currency": "USD"
                }
            ]
        },
        {
            "sku": "SKU-29002",
            "name": "Parker chair",
            "prices": [
                {
                    "price_type": "base",
                    "amount": 9200,
                    "currency": "USD"
                },
                {
                    "price_type": "retail",
                    "amount": 8400,
                    "currency": "USD"
                }
            ]
        }
    ]
}

After

result
{
    "products": [
        {
            "sku": "SKU-29001",
            "name": "Hudson lamp",
            "price": 1290,
            "currency": "USD"
        },
        {
            "sku": "SKU-29002",
            "name": "Parker chair",
            "price": 8400,
            "currency": "USD"
        }
    ]
}

What to keep in mind

  • If the price type is one exact value, use equals without a regular expression.
  • This differs from filtering by currency: here the price type is selected inside one array.

Process data faster with Eofferix

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

Sign up