0

I have got my Liquid map working for all other entities but if I try to rename for e.g. @odata.etag object to odata.etag the map's output is an empty string so I guess it cannot access the entity with "@" in it. Another example of this is on OData API which has a "friendly name" e.g. code@OData.Community.Display.V1.FormattedValue. I can access and remap code but if I try to remap the friendly name it outputs an empty string.

I tried to use the following Liquid template:

[
        {%- for i in body.value -%}
        {
        "etag": "{{i.@odata.etag}}", //This does not work
        "type": "{{i.type}}", // This works
        "typename": "{{i.type@OData.Community.Display.V1.FormattedValue}}" //This does not work
        }
        {%- if forloop.last == false -%}
        ,
        {%- endif -%}
        {%- endfor -%}
]

Example payload:

{
    "@odata.context": "",
    "value": [
        {
            "@odata.etag": "1",
            "type": "0001",
            "type@OData.Community.Display.V1.FormattedValue": "Normal",
        }
    ]
}

1 Answers1

0

I hit a similar situation working with OData formatted values using liquid in an Azure logic app. Hopefully my workaround works for you too in your environment.

Workaround: The workaround I found was to change the x.y@z reference into a x['y@z'] reference, using square brackets and single quotes rather than the dot to specify the field with the '@' in its name.

e.g. for your case:

"{{i.type@OData.Community.Display.V1.FormattedValue}}"

becomes

"{{i['type@OData.Community.Display.V1.FormattedValue']}}"