cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Corey_Gray
New Member

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

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
New Member

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"
  ]
}

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.

Thanks!

That is exactly what I was looking for.

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

Carousel_PP_768x460_Wave2 (1).png

2022 Release Wave 2 Plan

Power Platform release plan for the 2022 release wave 2 describes all new features releasing from October 2022 through March 2023.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (3,169)