Convert JSON to Custom Object in Power Automate Desktop

Recently, I was working with JSON strings in Power Automate. Here, we need to convert JSON to a custom object in Power Automate. In this tutorial, I will explain how to convert JSON to a custom object in Power Automate Desktop.

If you are new to Power Automate desktop, you should know the steps to install Power Automate Desktop, and you can check some Power Automate Desktop examples.

Power Automate Desktop: Convert JSON to a Custom Object

You can convert JSON strings to a custom object by using the Convert JSON to custom object action in Power Automate desktop.

A custom object is a pair of properties and values that can be easily converted into JSON format. You can see here an example:

Custom Object Structure: %{ 'Property1': 'Value1', 'Property2': 'Value2', 'Property3': 'Value2' }%

Suppose I have a User Profile Information in a JSON string. I wanted to convert this json into a custom object using Power Automate Desktop. Look at the code below.

{
  "user": {
    "username": "janesmith",
    "email": "[email protected]",
    "address": {
      "city": "London",
      "zip": "E1 6AN"
    }
  }
}

Here are the steps to do this:

  1. Open your Power Automate desktop app, + New drop-down, and add a Flow. In the Create a flow dialogue box, provide a flow name, and click on the “Create” button.
Convert Json to Custom Object PAD

Next, add the JSON to a variable.

  1. From the Actions pane, search for the “Set variable” action and drag and drop it into the workspace. Set the variable value and click on the Save button.
    • Variable: You can rename the variable produced if you wish. I have renamed it to UserDetails.
    • Value: Provide the JSON value here.
Power Automate Desktop Actions JSON to a Custom Object
  1. Below that, add the “Convert JSON to custom object” action, which will convert the json string to a custom object directly.
    • JSON: Click on {X} -> Select UserDetails variable.

This action will produce the JSONAsCustomObject variable. You can rename it according to your JSON string.

Power Automate desktop change JSON to custom object
  1. Now, the custom object has been created. I wanted to retrieve a user’s email from the custom object.
  2. To achieve this, drag and drop a “Display message” action. Configure the parameters below. Click on the Save button to save the action.
    • Message box title: Provide a title for the message box.
    • Message to display: Click on {x} -> Select variable from Convert JSON to custom object. Within brackets, provide the key along with the value that you want to get.
    • Message box icon: Select the Information option as an icon.

Here, I want to get an email from the User information, so that the expression will be [‘user’][’email’].

Message to display: %UserAsCustomObject['user']['email']%
Power Automate desktop Convert Json to custom object
  1. Now, the flow is ready. Click on the Save icon. Then run the flow by clicking the Run button.
Convert custom objects variables from JSON data Power Automate Desktop
  1. After the flow execution is complete, you can view the output below.

Output: Custom Object

Power Automate Desktop flow JSON string to custom object

Output: Extracted value from Custom Object [Email]

Convert JSON String to custom object using Power Automate desktop

This way, you can convert JSON to a custom object in Power Automate desktop flow.

In this tutorial, I explained how to convert JSON to a custom object in Power Automate Desktop. I hope you found this Power Automate Desktop tutorial helpful.

Also, you may like the following tutorials:

>

Build a High-Performance Project Management Site in SharePoint Online

User registration Power Apps canvas app

DOWNLOAD USER REGISTRATION POWER APPS CANVAS APP

Download a fully functional Power Apps Canvas App (with Power Automate): User Registration App

Power Platform Tutorial FREE PDF Download

FREE Power Platform Tutorial PDF

Download 135 Pages FREE PDF on Microsoft Power Platform Tutorial. Learn Now…