cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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

Microsoft Business Applications Virtual Launch Event

Watch the event on demand for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 Release Wave 2 Plan

Power Platform 2019 Release Wave 2 Plan

Features releasing from October 2019 through March 2020.

thirdimage

Flow Community User Group Member Badge

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

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 Flow Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 54 members 3,368 guests
Please welcome our newest community members: