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
Highlighted
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

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
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 Kudoed Authors
Users Online
Currently online: 320 members 6,010 guests
Please welcome our newest community members: