All Content
Timespan
explore our new search
ParseJSON with Power Apps for Graph Output Gallery
Image Source: Shutterstock.com
Power Apps
Sep 26, 2023 7:29 AM

ParseJSON with Power Apps for Graph Output Gallery

by HubSite 365 about Lewis Baybutt [MVP]

Power Platform Consultant 💬 at HybrIT Services | Low Code Lewis 👨🏻‍💻 | Microsoft 365 | Power Platform | SharePoint | Dynamics 365 | #CommunityRocks 🚀

Citizen DeveloperPower AppsLearning Selection

Discover how to utilize ParseJSON in Power Apps, leveraging Microsoft Graph via Power Automate for effective data management in your app.

In Lewis Baybutt's newest post, he examines the method of employing ParseJSON in Power Apps to populate a gallery with outputs from Microsoft Graph utilizing Power Automate. The digital application tool, ParseJSON(), lets us accept a JSON object and interpret it within the application platform. If one has a flow that obtains several records using the HTTP call stage and the Graph API, this function can help utilize the data in a user-friendly manner.

The ParseJSON() function, according to Lewis, enables us to utilize the resulting data, a JSON string, within our application and will subsequently yield an untyped object representing the structure of JSON. However, this method is not without its challenges. He points to the possible issue of an untyped object not comprehending data structures and therefore unable to understand data types in each corresponding field.

The blog guides us on how to leverage the ParseJSON() function to access the records and their fields in a JSON string within your application using the dot notation. The data conversion is a critical step to avoid issues associated with accessing the data directly. The data must be converted to a data type other than untyped object, along with a matching data type. The existence of fields is verified at runtime while utilizing untyped objects, meaning intellisense might not function as expected.

His article further provides insight by laying out a scenario to offer a more practical understanding. The aim is to show users within an organization in a Canvas app view. This is done with the help of Graph API, the application platform, Power Automate, and the ParseJSON() function. An overview of Building the Flow is provided as the steps escalate, creating a cloud flow, and the usage of an HTTP step to gather data.

Setting the authentication with Active Directory OAuth and using an app registration in Azure AD to authenticate against this step is discussed. Lewis has also included guidance for testing the flow in order to evaluate the data and how it's returned. The final step is presenting the array 'value' acquired from the step rather than the total body response.

In the final stages of the post, Lewis discusses the creation of a Canvas App in the solution. A label added to the top of the app for descriptive purposes. The app's OnStart property helps activate the flow, pulling the JSON string back into a variable using ParseJSON(). Additionally, for data display, a gallery is added to the screen, with labels added to display specific record fields. In the end, the app might need some user interface cleanups, but as per Lewis, it serves the purpose of functionality understanding.

Lewis concludes his blog post by expressing hope that this article enlightens on the usage of untyped objects and ParseJSON() in Power Apps. He urges readers who may require further clarification to reach out.

Understanding Power Apps and ParseJSON Function

The Power Apps digital application platform provides tools, such as the ParseJSON function, that allow for efficient and user-friendly interpretation of JSON objects. This is particularly useful when working with multiple records obtained through the HTTP call stage and the Graph API. Converting data to match the appropriate data type avoids the challenges posed by directly accessing data.

For more information about Power Apps and the ParseJSON function, visit this link.

Read the full article Using ParseJSON in Power Apps to populate a gallery with outputs from Graph

Power Apps - Guide: ParseJSON with Power Apps for Graph Output Gallery

Learn about Using ParseJSON in Power Apps to populate a gallery with outputs from Graph

The ParseJSON function in Power Apps is a potent tool that enables developers to comprehend and manipulate JSON data, allowing them to utilize Microsoft Graph and Power Automate to enhance their apps. This function enables Power Apps to comprehend JSON data and return an untyped object representing the structure of JSON. But while ParseJSON simplifies the process of working with JSON data, it also presents some challenges.

Untyped objects are a data type in Power Fx that doesn't recognize data structures, leading to potential difficulties in data reading and typing. ParseJSON can access records and fields in a JSON string using dot notation, but this cannot be used directly, necessitating conversion of accessed data to a data type other than the untyped object.

Consider the scenario where you want to view users in your organization on your Canvas app. You can use the Graph API, Power Apps, Power Automate, and ParseJSON to achieve this. The first step is to create a cloud flow using the instant type, provide it with a name and select PowerApps as the trigger.

  • For data retrieval, an HTTP step should be added, with the method set to GET.
  • The request URL should be https://graph.microsoft.com/v1.0/users.
  • Authentication can be set to Active Directory OAuth, with Azure AD providing the authentication against this step.
  • The final step requires the creation of a string output parameter called Users, using the expression body('HTTP')['value']. After successful testing of the flow, your data is ready to be processed in the app.

Building a Canvas App utilising the data starts with adding a flow into the app using Power Automate. It's crucial to make sure that the experimental feature for the ParseJSON function and untyped objects is activated. This allows for the setting of a global variable containing a table of outputs from the flow with ParseJSON() creating an untyped object.

Create a gallery to display data and add labels to display each desired field per record. Data type conversions may be required to display values correctly in the gallery. After setting up the fields to be displayed, the final result is a comprehensible and efficient app.

The utilization of the ParseJSON function and untyped objects in Power Apps provides powerful tools for developers to parse JSON data effectively. Although complications may arise due to the unique nature of untyped objects, these issues can be mitigated with careful planning and understanding of the involved processes.

By learning and effectively applying the concepts and practices mentioned above, you can enhance your overall efficiency and capabilities in developing and manipulating superior application solutions using ParseJSON.

More links on about Using ParseJSON in Power Apps to populate a gallery with outputs from Graph

Using ParseJSON in Power Apps to populate a gallery with ...
Jan 15, 2023 — In this post, I'll explain a bit about the ParseJSON in Power Apps and how you can use this function to get a number of records back from ...
Using ParseJSON in Power Apps to populate a galle...
Jan 16, 2023 — In Power Apps, the ParseJSON function can be used to access data from a Graph API call and populate a gallery with outputs. The ParseJSON ...

Keywords

ParseJSON Power Apps, Power Apps Gallery, Graph Outputs in Power Apps, ParseJSON in Power apps Gallery, Populating gallery Power Apps, Power Apps Graph API, Power Apps ParseJSON, Graph Outputs Power Apps, Use ParseJSON in Power Apps, Power Apps Graph Outputs