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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Use ParseJSON in canva...
Power Apps
Suggested Answer

Use ParseJSON in canvas app

(1) ShareShare
ReportReport
Posted on by 19
Hi there,

I recently got in the place where the use of json formatted data is necessary. I am trying to explore the ParseJSON fx. I saw many guides on how to use it and that you have to cast a type to each element you try to present. However, I noticed on the official microsoft documentation that there is a second arguement you can pass to the function that is called type. It is described as a way to get a typed object instead by providing a schema for your json. I tried to find some examples of its use but I was not able. Has anyone tried this feature before?
 
Thanks for your help in advance!
Categories:
I have the same question (0)
  • Suggested answer
    Michael E. Gernaey Profile Picture
    53,504 Super User 2025 Season 2 on at
     
    So you can define the "type" yourself
     
    So as an example you can take json coming in and turn it into a typed object like this, now understand that you can also do Collections, so if you have abunch of these you could make it a collection, versus just a Variable that has "a child table".
     
    Let's pretend you had json that look like this from power automate:
    { "AnimalType: "Pig", "Weight": 45, "BeenVacinated": true}
     
    You would make this a string and pass it in
     
    And we want to use this as a Typed object
    Set(AnimalData,
            ParseJSON( singleAnimalString,
                 Table( AnimalType: Text, Weight: Number, BeenVacinated: Boolean })
            )       
    )
    Now you would access the data (whether its 1 record or 20 by using simple dot notation or you can also access rows by using Index, First, FirstN, Last, LastN or a look
     
    AnimalData.Animaltype
    AnimalData.Weight
    AnimalData.BeenVacinated
     
    If you wanted to have multiple rows you would have something like this to input it
     
    [
       { "AnimalType: "Pig", "Weight": 45, "BeenVacinated": true },
       { "AnimalType: "Dog", "Weight": 20, "BeenVacinated": true },
       { "AnimalType: "Cat", "Weight": 10, "BeenVacinated": false }
    ]
     
    And you would convert this to a string (heck it could be a collection already that you are just playing with)
     
    Set(AnimalData,
            ParseJSON( multipleAnimalString,
                 Table( AnimalType: Text, Weight: Number, BeenVacinated: Boolean }
            )       
    )
     
    I hope that helps

    If these suggestions help resolve your issue, Please consider Marking the answer as such and also maybe a like.

    Thank you!
    Sincerely, Michael Gernaey
  • CU17101437-0 Profile Picture
    19 on at
    Hi @Michael E. Gernaey,

    Thanks for your answer. This gives me a better understanding of that parameter.
     
    I am wondering though how would I use it if my json had a more complicated structure like having an array of arrays or even objects? For example, what if my json is like this
    [
    {
    relationship: [
    {Value1: null, Value2 : "1", Value3: true}
    ],
    type : [
    {Value: 0},
    {Value: 2}
    ]
    }
    ]
  • CU17101437-0 Profile Picture
    19 on at
    @Michael E. Gernaey also, it seems that there might be something off with the syntax in your example. I tried to replicate it and some of the parenthesis or curly brackets seem not to be located on the correct space.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 740 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 342 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard