> ## Knowledge Base Index
> Fetch the complete knowledge base index at: https://help.stock-sync.com/sitemap.xml
> Use this file to discover available pages before exploring further.
> Pure-Markdown content can be obtained by appending a '.md' suffix to the content URLs listed in the sitemap (without the trailing slash).

# How do I configure XML parent and variant nodes?

Stock Sync supports **JMESPath expressions** in combination with **Liquid templating**, giving you powerful tools to transform and extract data from both **JSON** and **XML feeds**.

In stock sync, you can configure the parent XML node and the variant node in Feed Manager (Step 1)

This article explains how to configure **Parent Node** and **Variant Node** settings in Stock Sync to handle structured data, especially useful for feeds where variant data is nested or stored separately.

## 📘 What Are JMESPath and Liquid?

* **JMESPath** is a query language for JSON that lets you filter, project, and manipulate feed data. Learn more: [jmespath.org](https://jmespath.org)
        
* **Liquid** is a templating language used to reference dynamic values (like Shopify's `{{product.id}}`). Learn more: [Shopify Liquid Reference](https://shopify.github.io/liquid/)

* To check the mapping in **Step 2: Matching Column** for the XML node, you can refer to it [here](https://help.stock-sync.com/en/article/how-to-map-xml-v2-4iwsjr/?bust=1750056771446). 

Before exploring JMESPath examples, let's cover a few essential concepts. While there's much to learn, I'll simplify it here by focusing on key aspects. For more in-depth information, refer to external resources.

###### 1. Basic Expressions

* To select a specific expression value from **"b"** in a JSON object, use the following example:

![](https://storage.crisp.chat/users/helpdesk/website/-/f/c/0/f/fc0f30bc5318e800/screenshot-2025-05-29-at-14118_uzk420.png =887xauto)
* To extract a nested value from **"value"** in a JSON object:

![](https://storage.crisp.chat/users/helpdesk/website/-/f/c/0/f/fc0f30bc5318e800/screenshot-2025-05-29-at-15155_jf4dcn.png =897xauto)
* There is an index expression as well which is known as to select a specific element in a list. It should look similar to array access in common programming languages. Indexing is 0 based.

![](https://storage.crisp.chat/users/helpdesk/website/-/f/c/0/f/fc0f30bc5318e800/screenshot-2025-05-29-at-20045_1a2jk7.png =908xauto)
* Index expression to **select a specific element from a list containing two elements** separated by another element.
![](https://storage.crisp.chat/users/helpdesk/website/-/b/2/1/9/b219050a5836c000/screenshot-2025-06-04-at-32623_118432.png)
###### 2. Slicing 

* Slicing extracts a specific portion of a sequence by specifying a start and end index. For example, slicing from index 0 to 3 retrieves the first three elements.
![](https://storage.crisp.chat/users/helpdesk/website/-/f/c/0/f/fc0f30bc5318e800/screenshot-2025-05-29-at-10511_aqkhpv.png =885xauto)

* If the start or stop value is omitted, it defaults to the beginning or end of the array respectively, as shown in the image with the ending index which only gets 5 elements. 
![](https://storage.crisp.chat/users/helpdesk/website/-/f/c/0/f/fc0f30bc5318e800/screenshot-2025-05-29-at-10512_1xucki3.png =883xauto)
* To get values with **even numbers** only, use this method.
![](https://storage.crisp.chat/users/helpdesk/website/-/b/2/1/9/b219050a5836c000/screenshot-2025-05-30-at-10484_78iduj.png =893xauto)

### Example 1: Standard XML Feed with Nested Variants

```json
{
  "products": [
    {
      "title": "T-Shirt",
      "stock_sync_variant_title": "Apparel",
      "variants": [
        {
          "title": "red-small-cotton",
          "quantity": 3
        },
        {
          "title": "blue-medium-cotton",
          "quantity": 4},
      ]
    },
    {
      "title": "Jeans",
      "stock_sync_variant_title": "Apparel",
      "variants": [
        {
          "title": "red-small-cotton",
          "quantity": 3
        },
        {
          "title": "blue-medium-cotton",
          "quantity": 4}, 
      ]
    },
    {
      "title": "Sweater",
      "stock_sync_variant_title": "Apparel",
      "variants": [
        {
          "title": "red-small-cotton",
          "quantity": 3
        },
        {
          "title": "blue-medium-cotton",
          "quantity": 4},
      ]
    }
  ]
}
```

* To retrieve all product details, use `products` as the parent node.
![](https://storage.crisp.chat/users/helpdesk/website/-/b/2/1/9/b219050a5836c000/all_1ig7cbi.jpg =892xauto)

* To specify only the end index, use `products[:2]` as the parent node.
![](https://storage.crisp.chat/users/helpdesk/website/-/b/2/1/9/b219050a5836c000/no-start-number_1tq6rfs.jpg =958xauto)

* To specify only the start index, use `products[1:]` as the parent node.
![](https://storage.crisp.chat/users/helpdesk/website/-/b/2/1/9/b219050a5836c000/no-ending_4j070x.jpg =949xauto)
### Example 2: XML Products Data

```json
{
  "root": {
    "products": [
      {
        "currency": "EUR"
      },
      {
        "product": {
          "url": "https://zuja.lt/daugkartinis-burbulinis-modelinas",
          "id": "1",
          "supplier_id": "1",
          "description": [
            {
              "language_id": "1",
              "title": "Daugkartinis burbulinis modelinas",
              "description": "<p><strong>Daugkartinis burbulinis modelinas </strong>- modeliuoji, modeliuoji ir niekad nesukietėja.</p><ol><li>Minkštas ir lengvas modelinas su stambiais polistirolo karoliukais.</li></p>",
              "short_description": ""
            },
            {
              "language_id": "2",
              "title": "Reusable Soft Foam",
              "description": "<p><strong>Reusable Soft Foam </strong>- shape it over and over again!</p><ul><li>Soft and lightweight modelling clay with polystyrene beads.</li><li>Does not dry up and can be used again and again </li>",
              "short_description": ""
            }
          ],
          "code": "78060",
          "sku": "78060",
          "barcode": "5712854177474",
          "price": "7.14",
          "price_without_vat": "5.9000",
          "price_old": "9.99",
          "price_old_without_vat": "8.2600",
          "note1": "0",
          "note2": "0",
          "total_quantity": "126",
          "minimum_quantity": "1",
          "product_categories": {
            "category_id": [
              "41",
              "42",
              "148",
              "151",
              "204"
            ]
          },
          "delivery_text": "1-2 d.d",
          "manufacturer_id": "31",
          "images": {
            "image": "https://zuja.lt/image/data/products/1/1/daugkartinis-burbulinis-modelinas_1.jpg"
          },
          "weight": {
            "prefix": "=",
            "measures": "kg.",
            "weight": "0"
          },
          "sizes": {
            "measures": "m.",
            "width": "0",
            "height": "0",
            "length": "0"
          },
          "status": "1",

    "variants" :
            {
              "type": "select"
            },
              "variant": [
                {
                  "title": "Raidė"
                },
                {
                  "id": "5"
                },
                {
                  "title": "Raidė"
                },
                {
                  "price": "0.0000"
                },
                {
                  "price_prefix": "+"
                },
                {
                  "value_title": "A"
                },
                {
                  "quantity": "16"
                },
                {
                  "code": "BN82232"
                },
                {
                  "barcode": "4019359822320"
                },
                {
                  "weight": {
                    "prefix": "+",
                    "measures": "kg.",
                    "weight": "0.00000000"
                  }
                }
              ]
            }
      }
    ]
  }
}
```

* To retrieve the products list, you need to set the parent node as this `root.products[1:].product` or `root.products[*].product`
![](https://storage.crisp.chat/users/helpdesk/website/-/b/2/1/9/b219050a5836c000/screenshot-2025-05-30-at-41122_1yhhbcs.png)

### Example 3: Complex XML with Variants

```json
{
  "variant": [
    {
      "title": "Raidė"
    },
    {
      "id": "5"
    },
    {
      "title": "Raidė"
    },
    {
      "price": "0.0000"
    },
    {
      "price_prefix": "+"
    },
    {
      "value_title": "A"
    },
    {
      "quantity": "16"
    },
    {
      "code": "BN82232"
    },
    {
      "barcode": "4019359822320"
    },
    {
      "weight": {
        "prefix": "+",
        "measures": "kg.",
        "weight": "0.00000000"
      }
    }
  ]
}
```

* To get the variant list and specific variant values, set the variant node as `variant.{title: [].title | [0], id: [].id | [0], price: [].price | [0], quantity: [].quantity | [0], weight: [].weight | [0] }` can refer to the image below. If you only define the variant at the variant node level, all sections will be included. 

* If you didn't specify the variant node, you need to map it as this (e.g., `{{data.variant[3]}}` for the price). By specifying the variant node, you only need to map as a `price`

![](https://storage.crisp.chat/users/helpdesk/website/-/b/2/1/9/b219050a5836c000/screenshot-2025-05-30-at-42636_174t27v.png)

### Example 4: XML Products Data

```json
<data-set xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<record>
<Kod_EAN>4037571389087</Kod_EAN>
<Marka>AdHoc</Marka>
<Artykuł>AH-BE42</Artykuł>
<Nazwa_EN>Oil and vinegar dispenser MENAGE CRYSTAL</Nazwa_EN>
<Nazwa_PL>Dyspensery do oliwy lub octu MENAGE CRYSTAL</Nazwa_PL>
<Opis>Specjalna pompka ułatwia dokładne dozowanie zawartości, a specjalnie zaprojektowany nalewak przechwytuje wszystkie kropelki. Dyspenser można napełnić w bardzo łatwy sposób dzięki dużemu otworowi, który otrzymujemy po odkręceniu górnej części dyspensera. W zestawie z dyspenserami znajduje się elegancka drewniana podstawka. Nie należy myć w zmywarce. Produkt zaprojektowany przez AdHoc Design Team. Materiał: stal nierdzewna, akryl, drewno akacjowe. Wymiary zestawu: długość – 13,5cm, szerokość – 6,7cm, wysokość – 18,5cm. Wymiary dyspensera: średnica – 5,6cm, wysokość – 18cm, pojemność – 75ml.</Opis>
<Wymiary>13,5x6,7x18,5</Wymiary>
<Ilość_szt_w_kartonie>4</Ilość_szt_w_kartonie>
<Cena_detal_netto_zł_szt>215.37</Cena_detal_netto_zł_szt>
<Cena_detal_brutto_zł_szt>264.9</Cena_detal_brutto_zł_szt>
<Zdjęcie_1>http://lena-e.pl/download/Download/pliki/graf/AH/AH-BE42_P_01.jpg</Zdjęcie_1>
<Zdjęcie_2>http://lena-e.pl/download/Download/pliki/graf/AH/AH-BE42_PZA_01.jpg</Zdjęcie_2>
<Zdjęcie_3>http://lena-e.pl/download/Download/pliki/graf/AH/AH-BE42_PZA_02.jpg</Zdjęcie_3>
<Zdjęcie_4>http://lena-e.pl/download/Download/pliki/graf/AH/AH-BE42_PZA_03.jpg</Zdjęcie_4>
<Zdjęcie_5>http://lena-e.pl/download/Download/pliki/graf/AH/AH-BE42_PZA_04.jpg</Zdjęcie_5>
</record>
```

* To retrieve the products list, you need to set the parent node as this `"data-set"[].record` 


### Example 5: XML Products Data with repeating nodes with different name

```json
root:
  some_path:
    item_0: ...1st product data,
    item_1: ...2nd product data,
    ...and so on
```

* To directly access the product data within `root.some_path` without iterating through keys (item_0, item_1, etc.), use the `values()` function. Applying `values(root.some_path)` automatically retrieves all the product data stored under that path.

