Convert Delimited String Into Array Of Objects(Preview)

Template ID: stringtoarray

Converts a delimited string to an array of JSON objects. Each value is assigned to the user-specified property within each corresponding object. This template is available in Power Apps and Power Automate.

To start, specify the path to the parent object or collection. Then, specify the property subpath of the delimited string within the parent. Next, specify the delimiters to parse, and the property name of each child object that the string will be converted into. Finally, specify the path where the array will be written to. To overwrite the existing string, the path would be the previously specified parent path and property subpath.

This template doesn't support transformations to an array of strings ("3:0"["3", "0"]). We only support transformations to arrays of objects because this is a common behavior in connectors. Therefore, specifying the child property name is a requirement.

Examples

Example 1

Input JSON:

    {
        "peopleObject":{
            "XYZ":{
                "Age": "3;0"
            },
            "ABC":{
                "Age": "23;45"
            }
        }
    }
Input ParameterValue
propertyParentPath@body()
propertySubPathpeopleObject.XYZ.Age
delimiterList;
childPropertyNameAgeW
newPropertyPath@body.peopleObject.XYZ.Age

Output JSON:

    {
        "peopleObject":{
            "XYZ":{
                "Age":[
                    {
                        "AgeW": "3"
                    },
                    {
                        "AgeW": "0"
                    }
                ]
            },
            "ABC":{
                "Age": "23;45"
            }
        }
    }

Examples from open-sourced connectors

We have one instance of this template being used in our open-sourced connectors repository.

ConnectorScenario
PlannerConvert strings of userIds that are separated by a semicolon into an array

Input Parameters

Name Key Required Type Description
Target object or collection path x-ms-apimTemplateParameter.propertyParentPath True String Path to the object or collection, which contains the property.
Property subpath x-ms-apimTemplateParameter.propertySubPath String Property subpath within the object or collection.
Delimiter list x-ms-apimTemplateParameter.delimiterList True String List of delimiters.
Object child-property name x-ms-apimTemplateParameter.childPropertyName True String Name of the property within each object that should contain the array item value.
Path of the new property x-ms-apimTemplateParameter.newPropertyPath True String Path of the new property.
Run policy on x-ms-apimTemplate-policySection True Enum Specifies when to run this policy
- Request: Policy template will run before request is sent to the backend API.
- Response: Policy will run after receiving response from the backend API.
Operations x-ms-apimTemplate-operationName Array Policy will run on the selected list of actions and triggers. If no operation is selected, this policy will apply to all operations.