Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Copilot Studio - Bot Administration
Unanswered

Create JSON array out of user responses in Copilot Studio

Like (0) ShareShare
ReportReport
Posted on 8 Jan 2025 11:34:16 by
Hi All,
 
I am trying to create JSON array out of the user responses. How can we do that in Copilot studio? 
 
Any help will be much appreciated!
 
Thank you.
Categories:
  • SaiRT14 Profile Picture
    1,961 Super User 2025 Season 1 on 08 Jan 2025 at 17:32:57
    Create JSON array out of user responses in Copilot Studio
     
    Create a prompt action in Copilot Studio to gather input from the user.
    Use a structured approach to capture multiple responses, such as using placeholders or asking sequential questions.
    Use the input from the user and structure it into JSON format.
     
    Define a backend or inline function to parse and store the responses dynamically.
    function createJsonArray(responses) {
        const jsonArray = responses.map(response => ({
            key: response.key,
            value: response.value
        }));
        return JSON.stringify(jsonArray);
    }
     
    Use an Action in Copilot Studio to concatenate or structure the responses into a JSON array dynamically.
    [
        {
            "name": "John Doe",
            "email": "johndoe@example.com",
            "phone": "123-456-7890"
        },
        {
            "name": "Jane Smith",
            "email": "janesmith@example.com",
            "phone": "987-654-3210"
        }
    ]
     
    save it to a database, or send it to an API endpoint.
     
    pls try and let me know if you need more details. 

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,518 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,749 Most Valuable Professional

Leaderboard

Featured topics

Loading started