Power Community

Power Community

Paste JSON/XML as classes in Visual Studio – Quick Tip

https://ecellorscrm.files.wordpress.com/2024/04/jsonxml-to-classes.png

Hi Folks,

With this post I will show you how you can quickly add classes for your JSON and XML in Power Platform using Visual Studio.

Sometimes, there will be requirements where you need to convert and replace your Power Automate Flows with custom code either using Plugins or Actions. In this case, you may definitely need to parse the response returned by REST API calls and you might need to create relevant classes to hold the parameters and attributes, creating these manually would be cumbersome and takes few minutes of time even for a good developer.

Here I am taking the example using JSON.

So, without further due, let’s see in this in action.

Step 1: So, just copy using Cntrl + C shortcut, this is mandatory, else you will not able to see the Paste JSON as Classes and Paste XML as classes under edit..


This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters

Step 2: Then open Visual Studio –> Edit –> Paste Special

Step 3: Click on Paste JSON As Classes and soon you should be able to see something as below.

That’s it, your classes are now generated from the copied JSON File, you can do pretty much the similar thing with XML.

Hope this helps someone trying to achieve a similar goal…

Cheers,
PMDY


Discover more from ECELLORS CRM Blog

Subscribe to get the latest posts to your email.

Author: Pavan Mani Deep Y

Passionate for Power Platform. A technology geek who loves sharing the leanings, quick tips and new features on Dynamics 365 & related tools, technologies. An Azure IOT and Quantum Computing enthusiast…

This post was originally published on this site

- Advertisement -spot_img

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisement - Advertisement

Latest News

Hands-On Challenge: Setting Up Omnichannel Voice in 30 Minutes with Azure Communication Services

I recently had the privilege of presenting at the European Power Platform Conference in Brussels, where I conducted two...

More Articles Like This

- Advertisement -spot_img