web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Need Help with Compari...
Power Automate
Answered

Need Help with Comparing Microsoft Forms Responses to JSON Array (key value)

(0) ShareShare
ReportReport
Posted on by 7
Hello, I need some help. 
 
My flow starts with the Trigger "When a new response is submitted", because I'm using Microsoft Forms. After that, it has an action called "Get response items". 
 
Then I Initialize a variable called "pregunta" (a string) that saves an answer from the Forms.

 

Captura de pantalla 2023-10-16 163411.png

The thing is, this answer can be 6 options, Option A to Option F (these are just examples, names are in Spanish). 
Each Option is assigned to a number, so: Option A = 1, Option B = 2, Option C = 3, and so on. 
 
(variable "numeroPregunta is 10, just because, to initialize it) 
 
Captura de pantalla 2023-10-16 163826.png

Chat GPT gave me this code for the Compose Action. 

if(equals(variables('pregunta'),variables('jsonPreguntas').jsonPregunta),variables('jsonPreguntas').jsonNumeroPregunta)

 

But it's not working.

 

Do you know how I can do this? 


Variable = "Cat" 


[

{"pet": "dog",

"color": "black"},

{"pet": "cat",

"color": "orange"},

"pet": "mouse",

"color": "white"}

]

 

new Variable = orange

I need to obtain the other parameters that match with my variable. 

Maybe I'm not using the json array correctly or something. 

Please, I would appreciate your help! 

Categories:
I have the same question (0)
  • v-bofeng-msft Profile Picture
    Microsoft Employee on at

    Hi @javieracortes04 ,

     

    I've made a test for your reference:

    1\The Form

    vbofengmsft_1-1697506085417.png

    2\My flow

    vbofengmsft_0-1697506001897.png

    3\Result

    vbofengmsft_2-1697506140035.png

     

    Best Regards,

    Bof

  • javieracortes04 Profile Picture
    7 on at

    First of all, thank you. 

    But I think I didn't explain myself so well. So sorry! 

     

    I need to "transform" the answer to an equivalent index. If the answer was Cat, then I need the variable set to 1. If the answer is Dog then variable = 2, and so on. 

     

    I need to do this with 2 questions, the first one has 6 options, but the second one has 41 options, so I hope the answer to my problem is not booleans or parallel branches.  


    image.png

     

    Best regards, 

    Javiera

  • Verified answer
    Chriddle Profile Picture
    8,638 Super User 2026 Season 1 on at

    These transformations can bedone with simple objects.

     

    Here an example flow where the trigger input is transformed to the according number:

    Chriddle_1-1697641117167.png

    "Test" Input:

    outputs('Transformation')[triggerBody()['text']]

     

     

    The flow run looks like this:

    Chriddle_0-1697641040002.png

     

  • javieracortes04 Profile Picture
    7 on at

    It did work! 

    Thank you so much! 

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 262 Super User 2026 Season 1

#2
Haque Profile Picture

Haque 227

#3
Expiscornovus Profile Picture

Expiscornovus 225 Most Valuable Professional

Last 30 days Overall leaderboard