cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Corey_Gray
Level: Power Up

Parsing JSON from MS Leads in Azure Table

Hi All,

   I am trying to send an email with MS Flow, with data from the MarketPlaceLeads table that is created when you create an offer in the Azure Marketplace.

I have this mostly working, however I am having an issue with the CustomerInfo node that is returned.

Flow is returning the following JSON

[
  {
    "odata.etag": "W/\"datetime'2019-03-20T13%3A03%3A06.9706647Z'\"",
    "PartitionKey": "3:2F20:2F2019",
    "RowKey": "xxxxxx:2Exxxxxx:2DPREVIEW:5F5EEB8E25:2D54DE:2D4C9A:2D90AA:2D4725D4E9C20E",
    "Timestamp": "2019-03-20T13:03:06.9706647Z",
    "ProductId": "xxxxxx.xxxxxx-preview",
    "CustomerInfo": "{\"FirstName\":\"MSFT_TEST_636886837858685373\",\"LastName\":\"MSFT_TEST_636886837858685373\",\"Email\":\"MSFT_TEST_636886837858685373@test.com\",\"Phone\":\"1234567890\",\"Country\":\"US\",\"Company\":\"MSFT_TEST_636886837858685373\",\"Title\":\"MSFT_TEST_636886837858685373\"}",
    "LeadSource": "MSFT_TEST_636886837858685373-MSFT_TEST_636886837858685373|MarketPlace Lead DisplayName (xxxxxx)",
    "ActionCode": "MSFT_TEST_636886837858685373",
    "PublisherDisplayName": "TSA Software",
    "OfferDisplayName": "MarketPlace Lead DisplayName (xxxxxx)",
    "CreatedTime": "03/20/2019 13:03:06",
    "Description": "MSFT_TEST_636886837858685373"
  },
  {
    "odata.etag": "W/\"datetime'2019-03-20T05%3A07%3A05.3040022Z'\"",
    "PartitionKey": "3:2F20:2F2019",
    "RowKey": "xxxxxx:2Exxxxxx:2DPREVIEW:5F811BF48D:2DBEF4:2D4E08:2DAEC0:2D8768CEF88476",
    "Timestamp": "2019-03-20T05:07:05.3040022Z",
    "ProductId": "xxxxxx.xxxxxx-preview",
    "CustomerInfo": "{\"FirstName\":\"MSFT_TEST_636886552238175426\",\"LastName\":\"MSFT_TEST_636886552238175426\",\"Email\":\"MSFT_TEST_636886552238175426@test.com\",\"Phone\":\"1234567890\",\"Country\":\"US\",\"Company\":\"MSFT_TEST_636886552238175426\",\"Title\":\"MSFT_TEST_636886552238175426\"}",
    "LeadSource": "MSFT_TEST_636886552238175426-MSFT_TEST_636886552238175426|MarketPlace Lead DisplayName (xxxxxx)",
    "ActionCode": "MSFT_TEST_636886552238175426",
    "PublisherDisplayName": "TSA Software",
    "OfferDisplayName": "MarketPlace Lead DisplayName (xxxxxx)",
    "CreatedTime": "03/20/2019 05:07:04",
    "Description": "MSFT_TEST_636886552238175426"
  }
]

As you can see, the Customer Info node is returned as a string, this should be JSON, is there any way to extract this info and reference it in an Email?

 

Flow images

Flow1.PNGFlow2.PNGFlow3.PNG

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Parsing JSON from MS Leads in Azure Table

Hi @Corey_Gray ,

 

Since CustomerInfo is also a JSON object, you could use Parse JSON in Apply to each again.

Fill the following Schema into Parse JSON 2 action, and then use CustomerInfo parsed in Parse JSON from the previous step as the second Parse JSON Body.

{
    "type": "object",
    "properties": {
        "FirstName": {
            "type": "string"
        },
        "LastName": {
            "type": "string"
        },
        "Email": {
            "type": "string"
        },
        "Phone": {
            "type": "string"
        },
        "Country": {
            "type": "string"
        },
        "Company": {
            "type": "string"
        },
        "Title": {
            "type": "string"
        }
    }
}

Image reference:

5.PNG

Please take a try.

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
Corey_Gray
Level: Power Up

Re: Parsing JSON from MS Leads in Azure Table

Below are the currently working JSON Schema, and the Schema that i need to use to get the correct data out of the JSON response

Curent

{
    "type": "array",
    "items": {
        "type": "object",
        "properties": {
            "odata.etag": {
                "type": "string"
            },
            "PartitionKey": {
                "type": "string"
            },
            "RowKey": {
                "type": "string"
            },
            "Timestamp": {
                "type": "string"
            },
            "ProductId": {
                "type": "string"
            },
            "CustomerInfo": {
                "type": "string"
            },
            "LeadSource": {
                "type": "string"
            },
            "ActionCode": {
                "type": "string"
            },
            "PublisherDisplayName": {
                "type": "string"
            },
            "OfferDisplayName": {
                "type": "string"
            },
            "CreatedTime": {
                "type": "string"
            },
            "Description": {
                "type": "string"
            }
        },
        "required": [
            "odata.etag",
            "PartitionKey",
            "RowKey",
            "Timestamp",
            "ProductId",
            "CustomerInfo",
            "LeadSource",
            "ActionCode",
            "PublisherDisplayName",
            "OfferDisplayName",
            "CreatedTime",
            "Description"
        ]
    }
}

Proposed

{
  "type": "array",
  "items": {
    "type": "object",
    "properties": {
      "odata.etag": {
        "type": "string"
      },
      "PartitionKey": {
        "type": "string"
      },
      "RowKey": {
        "type": "string"
      },
      "Timestamp": {
        "type": "string"
      },
      "ProductId": {
        "type": "string"
      },
	  "CustomerInfo": {
			"type": "object",
			"properties": {
			  "FirstName": {
			  "type": "string"
			  },
			  "LastName": {
				"type": "string"
			  },
			  "Email": {
				"type": "string"
			  },
			  "Phone": {
				"type": "string"
			  },
			  "Country": {
				"type": "string"
			  },
			  "Company": {
				"type": "string"
			  },
			  "Title": {
				"type": "string"
			  }
			}
	  },
      "LeadSource": {
        "type": "string"
      },
      "ActionCode": {
        "type": "string"
      },
      "PublisherDisplayName": {
        "type": "string"
      },
      "OfferDisplayName": {
        "type": "string"
      },
      "CreatedTime": {
        "type": "string"
      },
      "Description": {
        "type": "string"
      }
    }
  
  },
  "required": [
    "odata.etag",
    "PartitionKey",
    "RowKey",
    "Timestamp",
    "ProductId",
    "LeadSource",
    "ActionCode",
    "PublisherDisplayName",
    "OfferDisplayName",
    "CreatedTime",
    "Description"
  ]
}
Community Support Team
Community Support Team

Re: Parsing JSON from MS Leads in Azure Table

Hi @Corey_Gray ,

 

Since CustomerInfo is also a JSON object, you could use Parse JSON in Apply to each again.

Fill the following Schema into Parse JSON 2 action, and then use CustomerInfo parsed in Parse JSON from the previous step as the second Parse JSON Body.

{
    "type": "object",
    "properties": {
        "FirstName": {
            "type": "string"
        },
        "LastName": {
            "type": "string"
        },
        "Email": {
            "type": "string"
        },
        "Phone": {
            "type": "string"
        },
        "Country": {
            "type": "string"
        },
        "Company": {
            "type": "string"
        },
        "Title": {
            "type": "string"
        }
    }
}

Image reference:

5.PNG

Please take a try.

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Corey_Gray
Level: Power Up

Re: Parsing JSON from MS Leads in Azure Table

Thanks!

That is exactly what I was looking for.

Helpful resources

Announcements
firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Solution Authors
Top Kudoed Authors (Last 30 Days)
Users online (3,706)