From ce67e84019c23c892c4c02cff0edc2761d564427 Mon Sep 17 00:00:00 2001 From: Watana Date: Thu, 6 Nov 2025 08:01:14 +1300 Subject: [PATCH 1/3] Simplify XML( ) example 4 --- .../expression-functions-reference.md | 31 +++++++++---------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/articles/logic-apps/expression-functions-reference.md b/articles/logic-apps/expression-functions-reference.md index 8b6c44fa219fd..69fa5b086e401 100644 --- a/articles/logic-apps/expression-functions-reference.md +++ b/articles/logic-apps/expression-functions-reference.md @@ -4971,7 +4971,17 @@ And returns this result XML: The `xml()` function expects either an object or a string containing valid XML. The function doesn't accept a raw array as input. -If your data is a JSON string, you can use the `json()` function to convert the string to a JSON object before you pass the result to the `xml()` function, for example: +If you have a JSON array, like the following example, you have four options. + +```json +[ + { "ID": 1, "Name": "James" }, + { "ID": 2, "Name": "John" }, + { "ID": 3, "Name": "Sam" } +] +``` + +Option 1: Convert JSON string to a JSON object before you pass the result to the `xml()` function, for example: ``` xml( @@ -4983,17 +4993,7 @@ xml( ) ``` -If you have a JSON array, like the following example, you have three options. - -```json -[ - { "ID": 1, "Name": "James" }, - { "ID": 2, "Name": "John" }, - { "ID": 3, "Name": "Sam" } -] -``` - -Option 1: Store the JSON array in a **Compose** action named **Compose1**. Then use the `outputs()` function to return a JSON object from **Compose1**. +Option 2: Store the JSON array in a **Compose** action named **Compose1**. Then use the `outputs()` function to return a JSON object from **Compose1**. ``` { @@ -5007,7 +5007,7 @@ Store the returned JSON object in another action named **Compose2**. You can the xml(outputs('Compose2')) ``` -Option 2: Store the JSON array in a **Compose** action named **Compose1**. Then use the `outputs()`, `concat()`, `json()`, and `xml()` functions to create XML from the JSON object output, for example: +Option 3: Store the JSON array in a **Compose** action named **Compose1**. Then use the `outputs()`, `concat()`, `json()`, and `xml()` functions to create XML from the JSON object output, for example: ``` xml( @@ -5019,10 +5019,9 @@ xml( ) ) ) - ``` -Option 3: Store the JSON array in a **Compose** action named **Compose1**. You can then use the `outputs()`, `json()`, `addProperty()`, and `xml()` functions to create XML from the JSON object output, for example: +Option 4: Similar to option 3, but uses `addProperty()` instead of concat() function to build the JSON object before passing the result to the xml() function, for example: ``` xml( @@ -5038,7 +5037,7 @@ xml( ) ``` -All examples, which include the JSON string data example and options 1 to 3, return the following XML result: +All examples, which include options 1 to 4, return the following XML result: ```xml From 22a9497c9afdfa5e48b402ba72ea5cc73a6afb01 Mon Sep 17 00:00:00 2001 From: Watana Date: Thu, 6 Nov 2025 17:52:23 +1300 Subject: [PATCH 2/3] Refine wording in Option 2 for better readability --- articles/logic-apps/expression-functions-reference.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/articles/logic-apps/expression-functions-reference.md b/articles/logic-apps/expression-functions-reference.md index 69fa5b086e401..30240f887334d 100644 --- a/articles/logic-apps/expression-functions-reference.md +++ b/articles/logic-apps/expression-functions-reference.md @@ -4993,7 +4993,7 @@ xml( ) ``` -Option 2: Store the JSON array in a **Compose** action named **Compose1**. Then use the `outputs()` function to return a JSON object from **Compose1**. +Option 2: Store the JSON array in a **Compose** action named **Compose1**. Then use the `outputs()` function to return a JSON object from **Compose1**, and store the returned JSON object in another **Compose** action named **Compose2**. ``` { @@ -5001,7 +5001,7 @@ Option 2: Store the JSON array in a **Compose** action named **Compose1**. Then } ``` -Store the returned JSON object in another action named **Compose2**. You can then use the `xml()` and `outputs()` functions to create XML from the JSON object output from **Compose2**, for example: +You can then use the `xml()` and `outputs()` functions to create XML from the JSON object output from **Compose2**, for example: ``` xml(outputs('Compose2')) From 57d14b22ab5d5460d3211770eebb45120be3f6b9 Mon Sep 17 00:00:00 2001 From: Watana Date: Thu, 6 Nov 2025 18:14:06 +1300 Subject: [PATCH 3/3] Refine Option 4 description --- articles/logic-apps/expression-functions-reference.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/articles/logic-apps/expression-functions-reference.md b/articles/logic-apps/expression-functions-reference.md index 30240f887334d..0b9922237afdd 100644 --- a/articles/logic-apps/expression-functions-reference.md +++ b/articles/logic-apps/expression-functions-reference.md @@ -5021,7 +5021,7 @@ xml( ) ``` -Option 4: Similar to option 3, but uses `addProperty()` instead of concat() function to build the JSON object before passing the result to the xml() function, for example: +Option 4: Similar to option 3, but uses `addProperty()` instead of the `concat()` function to create the JSON object before passing it to the `xml()` function, for example: ``` xml(