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. Option without a regular expression: add an export condition on neighboring price_type - Equals retail.

    JSON condition
    This makes Eofferix take amount only from the array item with the needed price type.
  4. Regular expression option: add an export condition on neighboring price_type - Regular expression ^retail$ (matches a value that is exactly retail).

    JSON condition
    This is the strict version of the same check when the price type must match fully.

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"
        }
    ]
}

Process data faster with Eofferix

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

Sign up