From 9b9649f923b2c69928a052d973b22db199bf7ad3 Mon Sep 17 00:00:00 2001 From: Watana Date: Thu, 23 Oct 2025 20:26:02 +1300 Subject: [PATCH 01/12] Convert JSON array to XML examples Added examples demonstrating how to use the xml() function with JSON data, including two options for converting JSON arrays to XML. --- .../expression-functions-reference.md | 72 +++++++++++++++++++ 1 file changed, 72 insertions(+) diff --git a/articles/logic-apps/expression-functions-reference.md b/articles/logic-apps/expression-functions-reference.md index a0360a975c721..869d99d4ace98 100644 --- a/articles/logic-apps/expression-functions-reference.md +++ b/articles/logic-apps/expression-functions-reference.md @@ -4966,6 +4966,78 @@ And returns this result XML: Seattle ``` +*Example 4* + +The xml() function does not accept a raw array as input. If your data is a JSON string, you can wrap it with the json() function to convert it into an object before passing it to xml(). + +``` +xml( + json('{"root":{"array":[ + { "ID": 1, "Name": "James" }, + { "ID": 2, "Name": "John" }, + { "ID": 3, "Name": "Sam" } + ]}}') +) +``` + +Suppose you have the JSON array and store in Compose1 action. + +```json +[ + { "ID": 1, "Name": "John" }, + { "ID": 2, "Name": "James" }, + { "ID": 3, "Name": "Sam" } +] +``` + +Option 1: Using a JSON object in Compose2 + +``` +{ + "root": { + "array": @{outputs('Compose1')} + } +} +``` + +and then create XML from the JSON object. + +``` +xml(outputs('Compose2')) +``` + +Option2: Using concat() + +``` +xml( + json( + concat( + '{"root":{"array":', + outputs('Compose1'), + '}}' + ) + ) +) +``` + +Options 1 and 2, along with the JSON string data, return this result: + +```xml + + + 1 + James + + + 2 + John + + + 3 + Sam + + +``` From c0800de6c246e8d31597548ac161361dd0d5b63b Mon Sep 17 00:00:00 2001 From: Watana Date: Thu, 23 Oct 2025 20:34:27 +1300 Subject: [PATCH 02/12] minor update --- 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 869d99d4ace98..3b8dc71bdac4c 100644 --- a/articles/logic-apps/expression-functions-reference.md +++ b/articles/logic-apps/expression-functions-reference.md @@ -5006,7 +5006,7 @@ and then create XML from the JSON object. xml(outputs('Compose2')) ``` -Option2: Using concat() +Option 2: Using concat() ``` xml( From e1115fd694dd442fe07bd6a9fd5f5f54c4037126 Mon Sep 17 00:00:00 2001 From: Watana Date: Thu, 23 Oct 2025 20:43:25 +1300 Subject: [PATCH 03/12] Minor update Clarified the input requirements for the xml() function, emphasizing that it expects an object or valid XML string and not a raw array. --- articles/logic-apps/expression-functions-reference.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/articles/logic-apps/expression-functions-reference.md b/articles/logic-apps/expression-functions-reference.md index 3b8dc71bdac4c..24127c8f71e95 100644 --- a/articles/logic-apps/expression-functions-reference.md +++ b/articles/logic-apps/expression-functions-reference.md @@ -4966,9 +4966,11 @@ And returns this result XML: Seattle ``` + *Example 4* -The xml() function does not accept a raw array as input. If your data is a JSON string, you can wrap it with the json() function to convert it into an object before passing it to xml(). +The xml() function expects either an object or a string containing valid XML. It does not accept a raw array as input. +If your data is a JSON string, you can wrap it with the json() function to convert it into an object before passing it to xml(). ``` xml( From 5e30492f003b54fb8d8066a1dadb256869e43aeb Mon Sep 17 00:00:00 2001 From: Watana Date: Thu, 23 Oct 2025 20:52:36 +1300 Subject: [PATCH 04/12] Update JSON sample --- 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 24127c8f71e95..9fdd0e7d8b5ed 100644 --- a/articles/logic-apps/expression-functions-reference.md +++ b/articles/logic-apps/expression-functions-reference.md @@ -4986,8 +4986,8 @@ Suppose you have the JSON array and store in Compose1 action. ```json [ - { "ID": 1, "Name": "John" }, - { "ID": 2, "Name": "James" }, + { "ID": 1, "Name": "James" }, + { "ID": 2, "Name": "John" }, { "ID": 3, "Name": "Sam" } ] ``` From 3306c90746f1dc1088aa5077b27a9ce15d92caa6 Mon Sep 17 00:00:00 2001 From: Watana Date: Sat, 25 Oct 2025 14:26:50 +1300 Subject: [PATCH 05/12] Update articles/logic-apps/expression-functions-reference.md Co-authored-by: Esther Fan --- articles/logic-apps/expression-functions-reference.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/articles/logic-apps/expression-functions-reference.md b/articles/logic-apps/expression-functions-reference.md index 9fdd0e7d8b5ed..74a32f336fa93 100644 --- a/articles/logic-apps/expression-functions-reference.md +++ b/articles/logic-apps/expression-functions-reference.md @@ -4969,7 +4969,8 @@ And returns this result XML: *Example 4* -The xml() function expects either an object or a string containing valid XML. It does not accept a raw array as input. +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 wrap it with the json() function to convert it into an object before passing it to xml(). ``` From 410b54035fe919b5a2b4dd2c68e1046426fb0e9a Mon Sep 17 00:00:00 2001 From: Watana Date: Sat, 25 Oct 2025 14:27:06 +1300 Subject: [PATCH 06/12] Update articles/logic-apps/expression-functions-reference.md Co-authored-by: Esther Fan --- 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 74a32f336fa93..2a76ee91b03ae 100644 --- a/articles/logic-apps/expression-functions-reference.md +++ b/articles/logic-apps/expression-functions-reference.md @@ -4971,7 +4971,7 @@ 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 wrap it with the json() function to convert it into an object before passing it to xml(). +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: ``` xml( From 6e39628617bc1468f83571af254e0348e5d7ac3f Mon Sep 17 00:00:00 2001 From: Watana Date: Sat, 25 Oct 2025 14:27:25 +1300 Subject: [PATCH 07/12] Update articles/logic-apps/expression-functions-reference.md Co-authored-by: Esther Fan --- 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 2a76ee91b03ae..8b444b58e3878 100644 --- a/articles/logic-apps/expression-functions-reference.md +++ b/articles/logic-apps/expression-functions-reference.md @@ -4983,7 +4983,7 @@ xml( ) ``` -Suppose you have the JSON array and store in Compose1 action. +If you have a JSON array, like the following example, you have two options. ```json [ From db818d03a6d4fa56fbb365e81f060114e0bd3778 Mon Sep 17 00:00:00 2001 From: Watana Date: Sat, 25 Oct 2025 14:27:38 +1300 Subject: [PATCH 08/12] Update articles/logic-apps/expression-functions-reference.md Co-authored-by: Esther Fan --- 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 8b444b58e3878..58f8ae2ed9745 100644 --- a/articles/logic-apps/expression-functions-reference.md +++ b/articles/logic-apps/expression-functions-reference.md @@ -4993,7 +4993,7 @@ If you have a JSON array, like the following example, you have two options. ] ``` -Option 1: Using a JSON object in Compose2 +Option 1: Store the JSON array in a **Compose** action named **Compose1**. Then use the `outputs()` function to return a JSON object from **Compose1**. ``` { From 1fb668ecd55032990a2093b6ef604ff8ad12675f Mon Sep 17 00:00:00 2001 From: Watana Date: Sat, 25 Oct 2025 14:27:52 +1300 Subject: [PATCH 09/12] Update articles/logic-apps/expression-functions-reference.md Co-authored-by: Esther Fan --- 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 58f8ae2ed9745..036630e58a8a4 100644 --- a/articles/logic-apps/expression-functions-reference.md +++ b/articles/logic-apps/expression-functions-reference.md @@ -5003,7 +5003,7 @@ Option 1: Store the JSON array in a **Compose** action named **Compose1**. Then } ``` -and then create XML from the JSON object. +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: ``` xml(outputs('Compose2')) From 12ea32d7f96fabd93f6949fd15559adf185e49ec Mon Sep 17 00:00:00 2001 From: Watana Date: Sat, 25 Oct 2025 14:28:06 +1300 Subject: [PATCH 10/12] Update articles/logic-apps/expression-functions-reference.md Co-authored-by: Esther Fan --- 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 036630e58a8a4..b358731c67e29 100644 --- a/articles/logic-apps/expression-functions-reference.md +++ b/articles/logic-apps/expression-functions-reference.md @@ -5009,7 +5009,7 @@ Store the returned JSON object in another action named **Compose2**. You can the xml(outputs('Compose2')) ``` -Option 2: Using concat() +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: ``` xml( From 8d14281743646add721f7b553e068853cce953db Mon Sep 17 00:00:00 2001 From: Watana Date: Sat, 25 Oct 2025 14:28:33 +1300 Subject: [PATCH 11/12] Update articles/logic-apps/expression-functions-reference.md Co-authored-by: Esther Fan --- 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 b358731c67e29..d3fab7c8048ac 100644 --- a/articles/logic-apps/expression-functions-reference.md +++ b/articles/logic-apps/expression-functions-reference.md @@ -5023,7 +5023,7 @@ xml( ) ``` -Options 1 and 2, along with the JSON string data, return this result: +All three examples, which include the JSON string data example, Option 1, and Option 2, return the following XML result: ```xml From 66e91542a023ffc166c06b80e39a746c841c90f8 Mon Sep 17 00:00:00 2001 From: Tracey Torble <56347952+ttorble@users.noreply.github.com> Date: Mon, 27 Oct 2025 14:04:26 +0000 Subject: [PATCH 12/12] Update articles/logic-apps/expression-functions-reference.md --- 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 d3fab7c8048ac..e08e564430131 100644 --- a/articles/logic-apps/expression-functions-reference.md +++ b/articles/logic-apps/expression-functions-reference.md @@ -5023,7 +5023,7 @@ xml( ) ``` -All three examples, which include the JSON string data example, Option 1, and Option 2, return the following XML result: +All three examples, which include the JSON string data example, option 1, and option 2, return the following XML result: ```xml