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

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

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
v-yuazh-msft
Community Support
Community Support

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

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!

 

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

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?

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
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Users online (2,036)