cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Lk
Frequent Visitor

Read Email from JSON object ,concatenate and assign them into one variable

Hi ,

I have results like below

{
  "d": {
    "results": [
      {
        "__metadata": {

     },
        "Title""xxxxxx",
        "Email""xxxx@xxx.com"
      },

 "__metadata": {

     },
        "Title""xxxxxx",
        "Email""xxxx@xxx.com"
      }


    ]
  }
}

I have above JSON am able to convert to JSON object but the problem is extract Email information from JSON and then concatenate with column need to use those Email Address to send emails at one go

Thanks in advance

1 ACCEPTED SOLUTION

Accepted Solutions
v-xida-msft
Community Support
Community Support

Hi @Lk,

 

Could you please show a bit more about the JSON object?

Do you want to extract email addresses from the JSON object?

 

I think there is something wrong with the JSON object that you provided, please check if you have provided a proper JSON object sample.

 

I assume that your JSON object data as below:

{
  "d": {
    "results": [
      {
        "__metadata": {
        "Title": "xxxxxx",
        "Email": "Test1@xxxxxx.onmicrosoft.com"
      }
      },
      {
 	"__metadata": {
        "Title": "xxxxxx",
        "Email": "Test3@xxxxxx.onmicrosoft.com"
      }
      }
    ]
  }
}

If you want to extract email address from above json object, please take a try with the following workaround:

  • Add a proper trigger, here I use Flow Button trigger.
  • Add a Variables-> "Initialize variable" action, Name set to EmailStrings, type set to String and Value set to empty.
  • Add a "Compose" action, Inputs field set to following JSON data:
{
  "d": {
    "results": [
      {
        "__metadata": {
        "Title": "xxxxxx",
        "Email": "Test1@xxxxxx.onmicrosoft.com"
      }
      },
      {
 	"__metadata": {
        "Title": "xxxxxx",
        "Email": "Test3@xxxxxx.onmicrosoft.com"
      }
      }
    ]
  }
}
  • Add a "Apply to each" action, input parameter set to following formula:
outputs('Compose')?['d']?['results']
  • Within "Apply to each" action, add a "Compose 2" action, Inputs field set to following formula:
concat(item()?['__metadata']?['Email'],';',variables('EmailStrings'))

Add a "Set variable" action, Name choose EmailStrings, Value set to output of the "Compose 2" action.

 

  • Under "Apply to each" action, add a "Compose 3" action, Inputs field set to EmailStrings variable.

Image reference:7.JPG

 

8.JPG

The flow works successfully as below:9.JPG

 

More details about using expression in flow actions, please check the following article:

Use expression in flow actions

 

 

Best regards,

Kris

Community Support Team _ Kris Dai
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

2 REPLIES 2
v-xida-msft
Community Support
Community Support

Hi @Lk,

 

Could you please show a bit more about the JSON object?

Do you want to extract email addresses from the JSON object?

 

I think there is something wrong with the JSON object that you provided, please check if you have provided a proper JSON object sample.

 

I assume that your JSON object data as below:

{
  "d": {
    "results": [
      {
        "__metadata": {
        "Title": "xxxxxx",
        "Email": "Test1@xxxxxx.onmicrosoft.com"
      }
      },
      {
 	"__metadata": {
        "Title": "xxxxxx",
        "Email": "Test3@xxxxxx.onmicrosoft.com"
      }
      }
    ]
  }
}

If you want to extract email address from above json object, please take a try with the following workaround:

  • Add a proper trigger, here I use Flow Button trigger.
  • Add a Variables-> "Initialize variable" action, Name set to EmailStrings, type set to String and Value set to empty.
  • Add a "Compose" action, Inputs field set to following JSON data:
{
  "d": {
    "results": [
      {
        "__metadata": {
        "Title": "xxxxxx",
        "Email": "Test1@xxxxxx.onmicrosoft.com"
      }
      },
      {
 	"__metadata": {
        "Title": "xxxxxx",
        "Email": "Test3@xxxxxx.onmicrosoft.com"
      }
      }
    ]
  }
}
  • Add a "Apply to each" action, input parameter set to following formula:
outputs('Compose')?['d']?['results']
  • Within "Apply to each" action, add a "Compose 2" action, Inputs field set to following formula:
concat(item()?['__metadata']?['Email'],';',variables('EmailStrings'))

Add a "Set variable" action, Name choose EmailStrings, Value set to output of the "Compose 2" action.

 

  • Under "Apply to each" action, add a "Compose 3" action, Inputs field set to EmailStrings variable.

Image reference:7.JPG

 

8.JPG

The flow works successfully as below:9.JPG

 

More details about using expression in flow actions, please check the following article:

Use expression in flow actions

 

 

Best regards,

Kris

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

Hi Kris,

Thank you so much for your explanation.But my data was outside _metadata.But I found out another solution by using "Append string variable" action.So I use apply to each and compose,Append string actions.In that way I acheived my goal

But big thanks to you for your idea

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.

May UG Leader Call Carousel 768x460.png

June User Group Leader Call

Join us on June 28 for our monthly User Group leader call!

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.

Power Automate Designer Feedback_carousel.jpg

Help make Flow Design easier

Are you new to designing flows? What is your biggest struggle with Power Automate Designer? Help us make it more user friendly!

Users online (1,112)