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 Apps / Get property name usin...
Power Apps
Unanswered

Get property name using ParseJSON

(0) ShareShare
ReportReport
Posted on by 1,207

I want to use ParseJSON to get the property names from an array called questions. The property names in the returned JSON string that I'm performing the ParseJSON operation are not consistent.

 

 Type casting the questions array to a table

Table(ParseJSON(lblCleanJSON.Text).questions)

 

Example JSON

 

I would like to get the three property names. In the example below they are: question, questionType and options. I can't refer to the property names by name because this string is likely to change.

{
 "surveyTitle": "Incident Reporting",
 "questions": [
 {
 "question": "What type of incident occurred?",
 "questionType": "dropdown",
 "options": ["Workplace injury", "Near-miss incident", "Property damage", "Security breach"]
 },
 {
 "question": "When did the incident occur?",
 "questionType": "dateTime",
 "options": []
 },
 {
 "question": "Where did the incident occur?",
 "questionType": "text",
 "options": []
 },
 {
 "question": "What caused the incident?",
 "questionType": "text",
 "options": []
 },
 {
 "question": "Did anyone witness the incident?",
 "questionType": "radio",
 "options": ["Yes", "No"]
 }
 ]
}

 

Categories:
  • Digital Profile Picture
    1,207 on at

    Or in simpler terms. How can I get the key names from the questions array in this JSON? Do I need to resort to the text functions?

     

    {
     "survey_title": "HR Quiz",
     "questions": [
     {
     "question": "What is the full meaning of HR? ",
     "question_type": "multiple choice",
     "options": [
     "A. Human Resource",
     "B. Human Right",
     "C. Human Relation",
     "D. Hostel Room"
     ]
     },
     {
     "question": "What do you understand by labor laws?",
     "question_type": "true/false",
     "options": [
     "True",
     "False"
     ]
     },
     {
     "question": "What is the main purpose of performance appraisal?",
     "question_type": "fill in the blank",
     "options": []
     },
     {
     "question": "Which type of communication mode is used for effective communication?",
     "question_type": "multiple choice",
     "options": [
     "A. Formal communication",
     "B. Informal communication",
     "C. Emotional communication",
     "D. Verbal communication"
     ]
     },
     {
     "question": "What is the difference between talent and skill?",
     "question_type": "short-answer",
     "options": []
     }
     ]
    }

     

  • v-bofeng-msft Profile Picture
    Microsoft Employee on at

    Hi @Digital ,

     

    Please try:

    ForAll(
     Table(ParseJSON(lblCleanJSON.Text).questions),
     { 
     question: Text(ThisRecord.Value.question), 
     questionType: Text(ThisRecord.Value.question), 
     options:ForAll(Table(ThisRecord.Value.options),Text(ThisRecord.Value))
     } 
     
    )

    vbofengmsft_0-1678675173806.png

     

    Best Regards,

    Bof

     

  • Digital Profile Picture
    1,207 on at

    Hi @v-bofeng-msft ,

     

    Thank you for your help. Unfortunately I can't use the method you suggest because the key names in the JSON can change. There will always be an array named 'questions' but the keys question, questionType and options often change in the JSON. I need a method of extracting the key names so I can rename them in my collection and display the data consistently in a gallery.

  • v-bofeng-msft Profile Picture
    Microsoft Employee on at

    Hi @Digital ,

     

    I'm afraid that is not available for now.

     

    Best Regards,

    Bof

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 236 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 188 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 130

Last 30 days Overall leaderboard