# Custom Liquid filters

Filters are simple methods that modify the output of numbers, strings, variables, and objects. They are placed within an output tag `{{ }}` and are denoted by a pipe character `|`. In addition to the standard filters, Stockeo also provides custom filters.

#### json\_parse, parse\_json <a href="#json_parse-parse_json" id="json_parse-parse_json"></a>

Allows parsing string in a format compliant with JSON file requirements into an object. It enables access to individual fields within the object using dot or bracket notation.

**Usage example:**\
\
Assume that individual product nodes don't contain category names, but only a `category_id`.

```xml
<?xml version="1.0" encoding="UTF-8"?>
<shop>
    <categories>
        <category>
            <id>101</id>
            <name>Electronics</name>
        </category>
        <category>
            <id>102</id>
            <name>Clothing</name>
        </category>
        <category>
            <id>103</id>
            <name>Home and Garden</name>
        </category>
    </categories>
    <products>
        <product>
            <name>Wireless Headphones</name>
            <sku>ELEC-001</sku>
            <category_id>101</category_id>
        </product>
        <product>
            <name>Sports T-Shirt</name>
            <sku>SPORT-002</sku>
            <category_id>103</category_id>
        </product>
    </products>
</shop>
```

If you want to add categories as tags, you can create a formula that creates an object with key-value pairs, so-called dictionary variable. In this case, keys are categories ids, and values - their names. With the formula below, the category name will be found by its ID:

{% tabs %}
{% tab title="Liquid code" %}

```liquid
{%- capture categories -%}
{"101":"Electronics","102":"Clothing","103":"Home and Garden"}
{%- endcapture %}
{%- assign categories = categories | json_parse -%}
{{ categories[category_id] }}
```

{% endtab %}

{% tab title="Stockeo settings" %}

<figure><img src="/files/iLDxjd8D4JRIleirqpvn" alt="Configuration screen showing usage of the json_parse filter to map and process JSON data in Stockeo"><figcaption><p>Example settings using the <code>json_parse</code> filter in Stockeo</p></figcaption></figure>
{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://help.stockeo.solvenium.com/custom-liquid-filters.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
