'Whitespaces handler in Liquid not working

I cannot figure out how to remove whitespaces from the start and end of my strings.
My response body is:

{
    "value": [
        {
            "nomeUnidadeOperacional": " ",
            "nomeCaixaPostalComunitaria": " ",
            "nroCaixaPostal": " ",
            "enderecoCaixapostal": " "
        }
    ]
}

I tried using "| split" and "{%- assign item = body.value[0] -%}" as the documentation for liquid explain "whitespace control".

My set-body:

<set-body template="liquid">
    {
        "Endereco": {       
            {% assign item = body.value[0] %}
            "caixaPostal": {
                "nome": "{{item.nomeCaixaPostalComunitaria | strip }}",
                "numero": "{{item.nroCaixaPostal | strip }}",
                "endereco": "{{item.enderecoCaixapostal | strip }}"
            }
        }
    }
</set-body>

What I'm getting:

{
    "Endereco": {
        "caixaPostal": {
            "nome": " ",
            "numero": " ",
            "endereco": " "
        }
    }
}

What I expected:

{
    "Endereco": {
        "caixaPostal": {
            "nome": "",
            "numero": "",
            "endereco": ""
        }
    }
}

Sure i could use a if to test if the content is " " and replace it after, but i could have more than 1 whitespace and this option isn't elegant.



Solution 1:[1]

On API Management you need to write the Filter Capitalized.

"nome": "{{item.nomeCaixaPostalComunitaria | Strip }}",

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Alex Lanes