logicapps icon indicating copy to clipboard operation
logicapps copied to clipboard

Logic app Liquid XML to JSON fails with empty result

Open steftux opened this issue 1 year ago • 2 comments

Describe the Bug with repro steps

  1. upload array.liquid with this content to integration account:

{% assign firstname = content.root.name[0] %} { "message": "Hi, how are you {{firstname}} ?" }

or

{ "message": "Hi, how are you {{content.root.name[0]}}?" }

  1. create logic app : with http and xml to json transformer and use @triggerBody() from When_a_HTTP_request_is_received as input.

  2. run with this content: tpye application/xml and payload:

<?xml version="1.0" encoding="UTF-8"?>
<root>
<name>Foo</name>
<name>Bar</name>
</root>

expected result:

{ "message": "Hi, how are you Foo ?" }

actual result:

{ "message": "Hi, how are you ?"}

What type of Logic App Is this happening in?

Consumption (Portal)

Are you using new designer or old designer

New Designer

Did you refer to the TSG before filing this issue? https://aka.ms/lauxtsg

Yes

Workflow JSON

{
  "definition": {
    "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
    "contentVersion": "1.0.0.0",
    "triggers": {
      "When_a_HTTP_request_is_received": {
        "type": "Request",
        "kind": "Http"
      }
    },
    "actions": {
      "Transform_XML_To_JSON": {
        "type": "Liquid",
        "kind": "XmlToJson",
        "inputs": {
          "content": "@triggerBody()",
          "integrationAccount": {
            "map": {
              "name": "array"
            }
          }
        },
        "runAfter": {}
      }
    },
    "outputs": {},
    "parameters": {
      "$connections": {
        "type": "Object",
        "defaultValue": {}
      }
    }
  },
  "parameters": {
    "$connections": {
      "value": {}
    }
  }
}

Screenshots or Videos

No response

Browser

Firefox

Additional context

client tracking id: 08584884372708382509795379022CU05

action tracking id: 861917f0-740f-4fbe-8431-afa00bc04bca

4/15/2024, 8:46:09 AM

AB#27663887

steftux avatar Apr 15 '24 08:04 steftux

If the liquid code is changed to output {{content.root.name}} it just prints the first element "Foo", which is also wrong as the Ruby implementation of Liquid outputs "FooBar". So there is no way of getting to the second instance of "name", is there?

steftux avatar Apr 15 '24 13:04 steftux

Passing this over to the backend issues and I’ll ping an engineer who can take a look.

hartra344 avatar Apr 15 '24 14:04 hartra344

This issue is stale because it has been open for 45 days with no activity.

github-actions[bot] avatar May 30 '24 15:05 github-actions[bot]

This issue was closed because it has been inactive for 14 days since being marked as stale.

github-actions[bot] avatar Jun 13 '24 16:06 github-actions[bot]