diff --git a/articles/logic-apps/expression-functions-reference.md b/articles/logic-apps/expression-functions-reference.md index 8b6c44fa219fd..0b9922237afdd 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**, and store the returned JSON object in another **Compose** action named **Compose2**. ``` { @@ -5001,13 +5001,13 @@ Option 1: 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')) ``` -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 the `concat()` function to create the JSON object before passing it 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