cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
mikedumka
Level: Powered On

Get Value from JSON, then display value in a Time Format

Hi There, 

I am getting better at building my flows, just parsed my first JSON that was inside another array (Whoa ... I got confused just writing that). But now I have run into a problem with formatting the date time value. 

The value I pull from the JSON is "PublishedTime" with a value of "2018-11-27T22:48:00Z".

The problem is that when I try to use the expression builder I can't access the "PublishedTime" value/identifer.

The only thing availible from the Parse JSON action is "body". 

I am kind of lost ... 

Thanks, Mike

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Get Value from JSON, then display value in a Time Format

Hi @mikedumka,

 

You could add a Compose action inside the Apply to each, and then refer to screenshot below to create the flow:

Capture.PNG

 

The expression in the Body field as below:

formatDateTime(outputs('Compose'),'yyyy-MM-dd')

Best regards,

Alice

View solution in original post

5 REPLIES 5
Community Support Team
Community Support Team

Re: Get Value from JSON, then display value in a Time Format

Hi @mikedumka,

 

Could you please share a screenshot of the configuration of your flow?

Could you please share more details about the JSON that you mentioned.

 

I have made a test on my side and my flow works fine to get the value in the JSON as below:

 

The JSON:

[
  {
    "Title": "1",
    "PublishedTime": "2018-11-27T08:00:00Z"
  }
]

The flow:

Capture.PNG 

 

Run history:

Capture.PNG

 

Please share more details so we would try to provide a proper workaround for you.

 

Best regards,

Alice

Highlighted
mikedumka
Level: Powered On

Re: Get Value from JSON, then display value in a Time Format

Thanks so much for the help ... 

 

I should have explained more, I can do everything you laid out, but when it comes to the expression builder, I want to format the time. So I have this ... which has the correct JSON value "PublishedTime"

 

2018-12-06_10-44-29.png

 

But as soon as I go into the "Expression" tab and try to format the time, the JSON value changes to "body" like below ... 

2018-12-06_10-48-10.png

 

What is going on with this ... and again, thank you so much for the help!

 

Community Support Team
Community Support Team

Re: Get Value from JSON, then display value in a Time Format

Hi @mikedumka,

 

You could add a Compose action inside the Apply to each, and then refer to screenshot below to create the flow:

Capture.PNG

 

The expression in the Body field as below:

formatDateTime(outputs('Compose'),'yyyy-MM-dd')

Best regards,

Alice

View solution in original post

mikedumka
Level: Powered On

Re: Get Value from JSON, then display value in a Time Format

I tried to accept this as a solution but am getting some strange authentication error, but thank you SO much for yelp. Worked like a charm. My only question is why do I have to use 'compose' rather than working with the value directly?
Super User
Super User

Re: Get Value from JSON, then display value in a Time Format

HI mike, You can do this an easy way. If you add the Dynamic content that you want in any part of an action ( this could be a compose). Then click in this field . Then Ctrl A and the Ctrl V it into the expressions editor then you will get the json to query what you want. Important note for this approach you will need to remove the @ sign and the curly brackets {} around the expression that you actually want.

Helpful resources

Announcements
firstImage

Power Platform Online Conference

Join us for the first ever Power Platform Online Conference!

firstImage

Incoming: New and improved badges!

Look out for new contribution recognition badges coming SOON!

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!

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
Users online (5,029)